Name
<customErrors>
Synopsis
<customErrors
defaultRedirect=Url
mode=mode >
<error statusCode=httpStatusCode
redirect=Url />
</customErrors>Specifies one or more pages to which users should be redirected if an unhandled exception is detected in an ASP.NET application. A default error page can be specified, as well as one or more error pages for specific HTTP error codes.
Scope
Any
Attributes
-
defaultRedirect Specifies the URL of the page to which all errors should be redirected when no specific error page is configured for the HTTP status code of the error. This attribute is optional.
-
mode Specifies the custom errors mode. Valid values are
Off,On, andRemoteOnly.Offdisables custom error handling,Onenables custom error pages for both local and remote requests.RemoteOnlyenables custom error pages for remote requests, while sending detailed error messages for local requests. This attribute is required.
Child Elements
<error>
Example
The example configures a default page to be displayed to remote clients when an unhandled exception is encountered:
<configuration>
<system.web>
<customErrors
defaultRedirect="Error.aspx" />
</system.web>
</configuration>Notes
If you set the mode attribute to
RemoteOnly, you will only be able to see detailed
error information from the local machine on which the pages are
running. Remote requests will return the custom error page (if any)
configured for the status code of the error that occurred.
If you want to see the debug information provided by ASP.NET ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access