2

I use typical custom error pages in IIS 7.5 like 404 or 401. I would like to know if there is a way to set custom error pages for individual error categories; for example:

403.16 - Client certificate is untrusted or invalid

or

401.2 - Logon failed due to server configuration

What's interesting is in IIS "error pages" it has an example (see image) of an error page with the 404.2 extension, but I can't seem to figure out how to add them.

enter image description here

Fergus
  • 1,313
  • 9
  • 19

1 Answers1

2

To create a custom error page for a category (or a subcategory as you want), you will need to follow the steps below.

IIS -> Features -> Error Pages -> Add -> Add Custom Error Page

You will need to type the number error code you want to create a custom error page for.

Then you fill out the rest of the form as you saw in the image you posted.

You can also do this with Command Prompt.

appcmd set config /section:httpErrors /+"[statusCode='403',subStatusCode='16',prefixLanguageFilePath='%SystemDrive%\inetpub\custerr',path='403-16.htm',ResponseMode='File']"

appcmd set config /section:httpErrors /+"[statusCode='401',subStatusCode='2',prefixLanguageFilePath='%SystemDrive%\inetpub\custerr',path='401-2.htm',ResponseMode='File']"

Clearly you will need to create the 403-16.htm and 401-2.htm error pages and you may need to adjust the filepath for your server but those commands should do what you want.

The Microsoft TechNet reference that you should read is [https://technet.microsoft.com/en-us/library/cc753103%28v=ws.10%29.aspx].1

user5870571
  • 2,900
  • 2
  • 11
  • 33