How to enable custom error pages locally(Kristofer Gafvert, July 9, 2010)
IIS 7 has a quite neat feature when it comes to showing errors in the browser - you can show different responses depending on if the client is local or remote. This feature is new in IIS 7, and was not available in previous versions of IIS.
The default setup is to show detailed errors for local requests, and show custom error pages for remote requests. This is in fact a very good setup, because you do not want to expose detailed error messages to remote client for several reasons. The major reasons are security (the less the client knows about your setup, the better), and user experience (the user wants to see something user friendly).
The default setup does however have one major disadvantage. If you have created your own custom error pages (with server side code), you cannot test them to verify that they work. IIS 7 will continue to show the detailed error message, and will not run your code.
Common situations for this are redirecting from http to https (there are several ways to accomplish this and using custom error pages is one of them), or you want to handle situations when a file is missing (redirect to the new location, or show recommended readings instead of the missing file).
To configure IIS to execute/show the custom error page, follow these instructions:
- In IIS Manager, click the website or virtual directory (depending on which level you want to configure this)
- In the middle pane, double click on "Error Pages"
- In the right pane, click "Edit Feature Settings"
- Select "Custom error pages" and click Ok
Applies to [?]
IIS 7.0, IIS 7.5