views:

348

answers:

1

This is customErrors section from my web.config file

<customErrors mode="On">
  <error statusCode="500" redirect="HTTP500.aspx" />
</customErrors>

HTTP500.aspx is the same as standard /Views/Shared/Error.aspx page.

When I get HTTP 500 error I see this page:

Server Error in '/' Application.

Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.


But when I change the above customErrors section like this:

<customErrors mode="On">
  <error statusCode="500" redirect="HTTP500.htm" />
</customErrors>

then HTTP500.htm page is displayed when HTTP 500 error occurs.

Why HTTP500.aspx page isn't displayed?

+1  A: 

I suspect its a problem with your routes. You may be mapping HTTP500.aspx to a non-existant controller method.

Peter Ruderman
I have only default routes. I didn't add any routes.
robert_d
Then this is your problem. When you ask IIS for a .htm file, it just serves it up (assuming you have appropriate permissions). When you ask it for an .aspx file, it routes it to the .NET framework. MVC then tries to map the request to a controller and method in your application, at which point it blows up.
Peter Ruderman