Configuring Custom Error Messages

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1

IIS can send standard HTTP 1.1 error messages or custom error messages. Custom error messages provide more informative, or friendly, feedback than standard error messages. By default, IIS is configured to send custom error messages from a file stored in the systemroot\Help\IisHelp\Common folder. You can also configure IIS to return a URL to a custom error message.

Important

You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type runas /user:Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".

Procedures

To configure custom error messages

  1. In IIS Manager, double-click the local computer; right-click the Web Sites folder, an individual Web site folder, a virtual directory, or a file; and then click Properties.

    Note

    Configuration settings made at the Web Sites level are inherited by all of the Web sites on the server. You can override inheritance by configuring the individual site or site element.

  2. Click the Custom Errors tab.

  3. In the Error messages for HTTP errors list, click the HTTP error that you want to change, and then click Edit.

    Note

    The following errors are not customizable: 400, 403.9, 411, 414, 500, 500.11, 500.14, 500.15, 501, 503, and 505.

  4. In the Message Type list box, click either File to return a custom error file or URL to direct the request to a custom error URL on the local machine.

    Important

    If your custom error is an .asp page, you must select URL. If you do not select URL, you risk returning .asp source code to the client.

  5. If you selected File, type the path to the file or click Browse to navigate to the file. Custom error messages are installed by default to the systemroot\Help\IisHelp\Common folder. The file names are numbers that correspond to the specific HTTP errors; for example, 400.htm, 401-1.htm, and so on.

    or

    If you selected URL, type the path to the Web site or virtual directory. The URL must be a Web site or a virtual directory on the local machine. In addition, the custom error URL must exist in the application pool that directs the request to the custom error URL. If you store custom error pages in a virtual directory, that virtual directory must run in the same application pool as the rest of your Web site. Otherwise, the worker process cannot serve the custom error page when it is requested.

  6. Click OK, and then click OK again.

If you upgraded from IIS 4.0, and you previously created your own custom error files or modified the custom error files that IIS 4.0 installed in the systemroot\Help\Common folder, your custom error files have been moved to the systemroot\Help\IisHelp\Common folder and given a .bak file name extension. You can retrieve your custom errors and reuse them. For example, the custom error file 400.htm that IIS 4.0 installed is now named 400.bak and is located in the systemroot\Help\IisHelp\Common folder (in addition to the new IIS custom error files).