ASP.NET Syntax ASP.NET Configuration Sections
Provides information about custom error messages for an ASP.NET application.
<customErrors
defaultRedirect = "url"
mode = "On | Off | RemoteOnly">
<error
statusCode = "statuscode"
redirect = "url" />
</customErrors>
The <customErrors
> tag supports two attributes and one subtag.
Attribute |
Option |
Description |
defaultRedirect |
|
Specifies the default URL to direct a browser to if an error occurs. |
mode |
|
Specifies whether custom errors are enabled, disabled, or shown only to remote clients. |
|
On |
Specifies that custom errors are enabled. |
|
Off |
Specifies that custom errors are disabled. |
|
RemoteOnly |
Specifies that custom errors are shown only to remote clients. |
Subtag |
Description |
<error > |
The error subtag can appear multiple times. Each appearance defines one custom error condition. |
The <error
> tag supports two attributes.
Attribute |
Description |
statusCode |
Specifies the error status code that redirects a browser to a nondefault error page. |
redirect |
Specifies the URL to redirect the browser to if an error occurs. |
The following example specifies the error handling pages to use for an ASP.NET application.
<configuration>
<system.web>
<customErrors defaultRedirect = "genericerror.html"
mode = "RemoteOnly">
<error statusCode = "500"
redirect = "InternalError.html" />
</customErrors>
</system.web>
</configuration>
ASP.NET Configuration CustomErrorsSection Class CustomErrorsMode Enumeration