How do I setup custom error for my ASP.net application?

DETAILS

ASP.net has its own built-in error handling.  To set up custom error handling for your ASP.net application, you will need to modify your web.config file.

As an example, if you want to redirect all 404 errors to error404.aspx, 500 errors to error500.aspx, and all other errors to error.htm, you would update the customErrors element in your web.config as follow

<customErrors mode="On" defaultRedirect="error.htm">
    <error statusCode="500" redirect="error500.aspx"/>
    <error statusCode="404" redirect="error404.aspx"/>
</customErrors>

CustomErrors is set to Off by default on all our servers.  If you do not customize the custom error element in the web.config file, the default ASP.net error (with debug information) will be displayed.

  • 0 Uživatelům pomohlo
Byla tato odpověď nápomocná?

Související články

After I configure the custom error setting in the control panel, I still get the generic error page?

DETAILS Custom error setting is a web server setting which affects all file types (.htm, .gif,...

How do I connect my ASP.net application to MySQL database?

DETAILSIn general, 2 different methods can be used to connect an ASP.net application to MySQL...

How do I get my ASP.net application to display non-English language?

DETAILSASP.net allows the developer to encode the page using character sets other than...

How do I get my ASP.net application to display non-English language?

DETAILSASP.net allows the developer to encode the page using character sets other than...

How to enable ASP.NET SQL Server Session on your web application

 DETAILS In ASP.NET, there are 3 different modes for storing session information....