[This is preliminary documentation and subject to change]

# Adding a Custom Error Message

You can map custom error messages to a file or to a URL by using the Custom Errors property sheet in the IIS snap-in.

###### To customize an error message by mapping to a file

1. Create a file that contains your custom error message, and place the file in a directory.
2. In the IIS snap-in, select the Web site, virtual directory, directory, or file in which you want to customize HTTP errors, and click Properties.
3. Select the Custom Errors property sheet.
4. Select the HTTP error that you want to change.
5. Click the Edit Properties button.
6. Select File from the Message Type box.
7. Type the path and file name that points to your customized error message, or use the Browse button to locate the file on your computer's hard disk.
8. Click OK.

###### To customize an error message by mapping to a URL

1. Create a file that contains your custom error message, and place it in a virtual directory.
2. In the IIS snap-in, select the Web site, virtual directory, directory, or file in which you want to customize HTTP errors, and click the Properties button.
3. Select the Custom Errors property sheet.
4. Select the HTTP error that you want to change.
5. Click the Edit Properties button.
6. Select URL from the Message Type box.
7. Type the URL which points to your customized error message by entering the path to the URL beginning with the virtual directory name.
8. Click OK.

Notes

- If you have an ASP file defined to handle a custom error, the script is invoked as a URL that passes context. For example, if you have an .asp file called Handle405.asp that is defined to handle HTTP 405 errors and a 405 error occurs when a user tries to access Example.htm, Handle405.asp file is invoked as if the user had typed

      http://example.microsoft.com/handle405.asp?405;http://example.microsoft.com/example.htm

- If you are using static custom error files (HTML files), you should always use the File option. If you plan to develop an application (by using ISAPI or ASP) to handle errors, then use the URL option. Note that the error status is handed to the application in the URL parameters and it is the application's responsibility to set the HTTP header status; otherwise, the HTTP response status will be "HTTP 1.1 200 OK."
- If you are using Internet Explorer 5.0 with Windows, Internet Explorer may replace the following custom errors with its own HTTP error. If the file size of the custom error is smaller than the size listed, the custom error is not used:
  403, 405, 410 - must be greater than 256 bytes
  400, 404, 406, 408, 409, 500, 500.12, 500.13, 500.15, 501, 505 - must be greater than 512 bytes

© 1997-2001 Microsoft Corporation. All rights reserved.