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

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

| improve this answer | |
  • You're welcome! Please feel free to mark the answer as accepted if this answers your question. – user5870571 Feb 13 '16 at 3:21
  • Absolutely, apparently I have to wait 5 minutes... – Fergus Feb 13 '16 at 3:22
  • 1
    lol apparently we solved the problem too quickly. ;) – user5870571 Feb 13 '16 at 3:23
  • ya that was fast... – Fergus Feb 13 '16 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.