robert_d
robert_d

Reputation: 259

Problem displaying custom error page in ASP.NET MVC 2

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?

Upvotes: 1

Views: 1378

Answers (2)

adamclerk
adamclerk

Reputation: 769

Have you tried the following?

routes.IgnoreRoute("HTTP500.aspx");

Upvotes: 0

Peter Ruderman
Peter Ruderman

Reputation: 12485

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

Upvotes: 1

Related Questions