I am trying to implement a global raw exception log in MVC 3. I configured my web.config like this.
<customErrors mode="On" defaultRedirect="/error/">
<error statusCode="500" redirect="/error/http500"/>
<error statusCode="404" redirect="/error/http404"/>
</customErrors>
When I throw an exception for the controller, it redirects to the error page, as expected. The problem is that when I use Server.GetLastError()in Global.asax, the exception is always
"The view 'Error' or its master was not found or no view engine supports the searched locations. The following locations were searched:\r\n~/Views/deanslist/Error.aspx\r\n~/Views/deanslist/Error.ascx\r\n~/Views/Shared/Error.aspx\r\n~/Views/Shared/Error.ascx\r\n~/Views/deanslist/Error.cshtml\r\n~/Views/deanslist/Error.vbhtml\r\n~/Views/Shared/Error.cshtml\r\n~/Views/Shared/Error.vbhtml"
I was expecting it to provide the actual exception that was thrown. What am I doing wrong?
source
share