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
.Off
disables custom error handling,On
enables custom error pages for both local and remote requests.RemoteOnly
enables 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 ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.