How to configure friendly error pages in IIS 7 (Windows 2008)

Release 1.02 - ...

Friendly error pages in IIS are configured using the IIS Manager. For IIS 7, open the IIS Manager, select a site and select Error Pages. Select a file for each specifc HTTP error you which to configure.

Configure Error Pages in IIS7

 

Like the <customerrors> tag in smartsite.config and web.config, IIS7 Error Pages supports 3 'levels' of error handling:

 

  • Custom error pages
    equivalent to <customerrors mode="On" ... />
  • Detailed pages
    equivalent to <customerrors mode="Off" ... />
  • Detailed errors for local requests and custom error pages for remote requests
    equivalent to <customerrors mode="RemoteOnly" ... />

These levels can be adjusted from the IIS Manager > Site Name > Error Pages > Edit Feature settings...

 

Custom Error settings in IIS7

Redirecting users to Smartsite items

For some common error pages like a 404 (File not found), you can redirect the user to a Smartsite item. You can do this by setting the 404 error page of IIS7 to the path "/smartsite.net?id=HTTP404&error=" and create an item with the code HTTP404. This way you can show the user a friendly page that can offer some extras like a search box or sitemap. Make sure that you never redirect a HTTP 500 (Internal server error) error back to Smartsite. HTTP 500 responses are often sent to the client if there is a problem in Smartsite or ASP.Net. Redirecting these users back to Smartsite can lead to recursion and eventually no proper error page for the site visitor.