The following sections describe attributes, child elements, and parent elements.
Attributes
|
Attribute
|
Description
|
| defaultRedirect | Optional attribute. Specifies the default URL to direct a browser to, if an error occurs. When this attribute is not specified, a generic error is displayed instead. The URL can be absolute (for example, www.contoso.com/ErrorPage.htm) or relative. A relative URL, such as /ErrorPage.htm, is relative to the Web.config file that specified the URL for this attribute, not to the Web page in which the error occurred. A URL starting with a tilde (~), such as ~/ErrorPage.htm, indicates that the specified URL is relative to the root path of the application. |
| mode | Required attribute. Specifies whether custom errors are enabled, disabled, or shown only to remote clients. This attribute can be one of the following values.
|
Value
|
Description
| | On | Specifies that custom errors are enabled. If no defaultRedirect attribute is specified, users see a generic error. The custom errors are shown to the remote clients and to the local host. | | Off | Specifies that custom errors are disabled. The detailed ASP.NET errors are shown to the remote clients and to the local host. | | RemoteOnly | Specifies that custom errors are shown only to the remote clients, and that ASP.NET errors are shown to the local host. This is the default value. |
The default is RemoteOnly. |
Child Elements
|
Element
|
Description
|
| error | Optional element. Specifies the custom error page for a given HTTP status code. The error tag can appear multiple times. Each appearance defines one custom error condition. |
Parent Elements
|
Element
|
Description
|
| configuration | Specifies the root element in every configuration file that is used by the common language runtime and the .NET Framework applications. |
| system.web | Specifies the root element for the ASP.NET configuration settings in a configuration file and contains configuration elements that configure ASP.NET Web applications and control how the applications behave. |