Поделиться через


<error> Element

Defines one custom error redirect associated with an HTTP status code.

<configuration>
   <system.web>
      <customErrors>
         <error>

<error statusCode="statuscode"
       redirect="url"/>

Optional Attributes

Attribute Description
StatusCode Specifies the HTTP status code that will result in redirection to the error page.
Redirect The error page that will present information to the client about the error.

Example

The following example specifies the error handling pages to use for an ASP.NET application.

<configuration>
   <system.web>
      <customErrors defaultRedirect="GenericError.htm"
                    mode="RemoteOnly">
         <error statusCode="500"
                redirect="InternalError.htm"/>
      </customErrors>
   </system.web>
</configuration>

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.CustomErrorsConfigHandler

See Also

<customErrors> Element | ASP.NET Configuration | ASP.NET Settings Schema