Share via


Custom Errors Tab, ASP.NET Configuration Settings Dialog Box

When an error occurs in an ASP.NET Web page or component, ASP.NET raises an error code. Errors can include the following types:

  • Compile-time.

  • Parser (malformed ASP.NET elements).

  • Configuration.

  • Run-time.

By default, ASP.NET dynamically generates an error page that contains a description of the error, the name of the page on which the error occurred, and a stack trace. If debug mode is enabled, the dynamically generated page also includes an excerpt of the source code where the error originated. By defining custom errors, you can specify how the Web application responds when an error occurs.

Note

For detailed information about debugging mode, see Application Tab, ASP.NET Configuration Settings Dialog Box.

To display the Custom Errors tab of the ASP.NET Configuration Settings dialog box

  1. In Microsoft Windows, open Administrative Tools, and then click Internet Information Services (IIS) Manager.

    IIS Manager appears.

  2. Under Internet Information Services, expand Servername (local computer), expand Web Sites, right-click either Websitename or Default Website, and then click Properties.

    The Web Site Properties dialog box appears.

  3. Click the ASP.NET tab, and then click Edit Configuration.

    The ASP.NET Configuration Settings dialog box appears.

  4. Click the Custom Errors tab.

Tasks

Using the Custom Errors tab, you can do the following:

  • Specify a default error page to display when an ASP.NET error occurs anywhere in the Web application.

  • Map specific HTTP error codes to corresponding error pages.

    Note

    Mappings work only for errors that ASP.NET is notified of. For example, by default, ASP.NET is not notified of HTTP 404 errors (page not found). If you want ASP.NET to receive these errors, you can set the Web site properties to map HTTP errors to .aspx pages.

  • Specify whether custom error pages are displayed for all users, no users, or remote (non-administrative) users.

UI Elements

  • Custom error mode
    Click a mode to specify how custom errors are displayed, as follows:

    • On   

      Custom error pages are always displayed. Use this setting to view errors while you are developing the Web application.

    • **Off   **

      Custom error pages are not displayed. Instead, errors result in a dynamically generated ASP.NET error page.

    • Remote Only   

      Errors are redirected only for requests that do not originate locally on the Web server. Use this mode to view ASP.NET errors while working on the server, but display custom errors the Web application users.

  • Default redirect URL
    Type the page name (.aspx or .htm) to display in response to unhandled errors anywhere in the Web application.
  • Inherited custom errors
    Lists the custom error pages that are inherited from configuration files that are higher in the hierarchy. You can override the inherited error settings by adding a local custom error for the status code you want to override.
  • Local custom errors
    Lists the error pages for the current Web site, specifically.
  • Add
    Click to open the Edit/Add Custom Error Handlers dialog box where you can specify an HTTP error code and the page to display when ASP.NET detects the error.

    Note

    Mappings work only for errors that ASP.NET is notified of. For example, by default, ASP.NET is not notified of HTTP 404 errors (page not found). If you want ASP.NET to receive these errors, you can set the Web site properties to map HTTP errors to .aspx pages.

    You must provide the HTTP error code and the URL of the page it maps to. The page that you reference does not have to be in the current Web site.

    Note

    IIS Manager does not validate the URL that you enter.

  • Edit
    Click to open the Edit/Add Custom Error Handlers dialog box where you can change the page name or error code for the page that you selected under Local custom errors.
  • Remove
    Click to delete an error page mapping.

See Also

Tasks

How to: Access ASP.NET Configuration Settings Programmatically

Reference

Authentication Tab, ASP.NET Configuration Settings Dialog Box
Authorization Tab, ASP.NET Configuration Settings Dialog Box
Locations Tab, ASP.NET Configuration Settings Dialog Box
connectionStrings Element (ASP.NET Settings Schema)
appSettings Element (General Settings Schema)

Concepts

ASP.NET Configuration Overview