Configure IIS 7 for Custom Error Pages
Page 1 of 2
Written by
Gregory Scot Collins
Tuesday, 31 July 2007, 9:32 PM
This article has been tested to work with the following products and versions. No guarantee of compatibility, with or without modification, is offered for products or versions other than those listed.
- Internet Information Services 7 (Microsoft)
Many Web sites use custom error pages to maintain site branding when a user encounters an error on that site. Other Web sites use custom error pages to perform URL rewriting—a way of allowing users to navigate the site with non-existent addresses and, behind the scenes, returning valid pages. Whatever they are used for, custom error pages are easy to set up and can be created using any valid page type, including, but not limited to, HTML and ASP.NET pages.
Internet Information Services (IIS) version 6, which shipped as part of Windows Server 2003 and, in a feature-limited version, as part of Windows XP, had custom errors turned on by default and only required specifying the custom page that a particular error code should use. IIS 7, however, is preconfigured to return detailed errors for local requests and custom error pages for remote requests. This change can be confusing to anyone making the transition from an earlier version of IIS to version 7. Without making the proper configuration changes, your attempts to use custom error pages will result in a server error, as shown in Screenshot 1.
Create a test custom error page
Use the following steps to test whether you have IIS 7 correctly configured to display custom error pages:
- Launch a text editor and copy the following code into it.
- Save the file as custom404.html in your Web folder (typically c:\inetpub\wwwroot).
- Launch your web browser.
- Navigate to http://localhost/noexist.
<html><body>My custom error page</body></html>
If IIS is not correctly configured, you will see an error message like the one shown in Screenshot 1. If it is correctly configured, you will see your custom error page, as shown in Screenshot 4.



Stumble It!
Digg It!
del.icio.us




