You create a custom error page when you don’t want a regular user to see the actual error message. You can always see a detailed error message when you browse the page locally on the server. There are three ways how you can set custom error page in IIS 7 / 7.5, today we will look at how to set a static file in the error response.
In IIS 6.0
- Right click on Web Site (Default Web Site in our case) and click on Properties
- Under Custom Errors tab, click on the error page you want to customize (in our case 403;4)
- Click Edit… and select the file by clicking on the Browse… button
In IIS 7 / 7.5
- Click on the Web Site (Default Web Site in our case)
- In Features View, double click on Error Pages
- Click Add…, under Status code: type 403.4
- Click "Insert content from static file into the error response", type custerr\403.4.htm
- Click OK

- Now, to set detailed error locally for the 403.4
- Click on 403.4 error page we configured and click on Edit Feature Settings…
- Under Error Responses, select “Detailed errors for local requests and custom error pages for remote requests”, click OK
Remember, I have a custerr folder in C:\Inetpub\wwwroot folder.
My web.config:
<httpErrors errorMode="DetailedLocalOnly">
<error statusCode="403" subStatusCode="4" path="custerr\403.4.htm" responseMode="File" />
</httpErrors>
If you are planning to customize the existing error page (in our case 403-4.htm) in the C:\inetpub\custerr\en-US folder. You will need to set the custom error page at the machine level.
My applicationHost.config:
<error statusCode="403" subStatusCode="4" prefixLanguageFilePath="C:\inetpub\custerr" path="403.4.htm"
responseMode="File" />
Hope this helps,
Vivek Kumbhar
Quote of the day:
I'm seventeen and I'm crazy. My uncle says the two always go together. When people ask your age, he said, always say seventeen and insane. - Ray Bradbury