Search
Web Braintrove
Site Navigation
Home
Products
Tags
Levels
Dates
Authors
5 MOST RECENT
Create Shared Rules
Perform a Case-Insensitive String Comparison without Using Translate()
Force a Field Value to a Boolean Using Rules
Quickly Crop to a Shadow
Sum Repeating Time Values
5 MOST POPULAR
Pass Query String Parameters to an ASP.NET Xml Control
Access a Method in a Master Page with Code-Behind
Prevent Namespace Prefixes from Being Copied to the Output
Create Groups in a Drop-Down List Box
Change the Default Action of the Power Button on the Windows Vista Start Menu
5 MOST FORGOTTEN
Install Windows 7 Beta onto a Virtual Machine
Configure Lab Color Mode Defaults for Braintrove Articles
Permanently Change the Default Styles for New Word Documents
Enable Themes in Windows Server
Conditionally Display the Singular or Plural Form of Words
Microsoft MVP
PopularMost Viewed
This article has been viewed 2848 times.

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.
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:
  1. Launch a text editor and copy the following code into it.
  2. <html><body>My custom error page</body></html>
  3. Save the file as custom404.html in your Web folder (typically c:\inetpub\wwwroot).
  4. Launch your web browser.
  5. Navigate to http://localhost/noexist.
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.
Bookmark this Article
StumbleUpon  Stumble It!
Digg  Digg It!
del.icio.us  del.icio.us
List of Figures
Screenshot 1 - By default, IIS 7 is set up to return detailed errors.
Screenshot 2 - Configuring IIS 7 to return a custom error page when a 404 error is encountered.
Screenshot 3 - Configuring IIS 7 to always return custom error pages.
Screenshot 4 - A custom error pages is returned when a 404 error is encountered.
See Also
Prevent Users from Seeing ASP.NET Error Pages
Article Tags
Great Deals
TigerDirect Exclusive Deals, Limited Time Offers, Act Now And Save!
Find all current special offers on Adobe products.
Try SugarSync Free!
Join WebHost4Life.com
TigerDirect
Computers4SURE (4SURE.com - An Office Depot Co.)
Copyright © 2006-2010 Braintrove. All rights reserved. Braintrove, braintrove.com, and the Braintrove logo are trademarks of Gregory Scot Collins in the United States and/or other countries. The names of actual companies and products mentioned herein may be the trademarks of their respective owners. Any rights not expressly granted herein are reserved.