Thursday 13 September 2012

IIS: customised error messages

   


Hey everybody! Today we are going to work on IIS, and give those boring error messages a new look.
Customising error pages is an underestimated thing by most web developer. However, as you may understand, it can really make our web site different, and - for example - prevent visitors from going away.
In order to customise the error pages we need to use IIS Manager on the web server. If you're not the server administrator, you can always ask for help. If your web site is hosted somewhere by some web hosting company, well... check if you've access to such configuration from your web site control panel (if you've such a tool) or ask the company directly.
Now... let's see how to customise error messages.

IIS
We need to consider two possible situations: IIS 6 and IIS 7.
Depending from what we are using, this is where to go:

IIS 6
  • Start IIS Manager
  • Right click the website, and click Properties
  • Click on the "Custom Errors" tab
  • Select 404 and click Edit
  • Set "Message type" to URL and set the "URL" to "/404/404.aspx"
  • Click Ok
  • Click Ok
IIS 6


IIS 7
  • Start IIS Manager
  • Click on the website
  • Go down to "Error pages" (in the IIS group) and double click it
  • Select 404 from the list and click Edit
  • Change to "Execute a URL on this site", and specify "/404/404.aspx"
  • Click Ok
IIS 7

If you want to try the custom 404 error locally, you also need to do the following for IIS 7:
  • Click "Edit Feature Settings..."
  • Select "Custom error pages" and click Ok
As you can see, it's not that difficult!

Why do it
In my opinion there are different reasons why we should customise error messages. As long as we have access to IIS console on the server, we should change those awful error messages with something more user friendly.
The first effect is that with a 404 error, the visitor is immediately aware of the fact that the web site is not down, it is not vanished from the web.
Secondly, we could redirect the visitor after a while. That way we can inform the visitor of the error, and subsequently redirect him/her to an appropriate page.

Have you ever used such customisation? Were you aware of it?
Share your experience using the comments section below...

0 thoughts:

Post a Comment

Comments are moderated. I apologize if I don't publish comments immediately.

However, I do answer to all the comments.