Shaun Mccran

My digital playground

02
M
A
R
2010

Changing the 404 template handler in IIS

You could use a 404 ColdFusion template to handle missing templates, or the onmissingtemplate Application CFC function. Luckily I have a client with half a dozen sites all on the same server, with nothing else on it, so it makes more sense to do this in Internet Information Services.

404 templates are a handy way of masking any site errors or missing templates. Not only are they a cosmetic fix to nasty display errors but they can also seriously help your server security.

A recent incident where I was helping a friend setup a custom tag path on his server demonstrated this. He couldn't remember where the webroot was to point ColdFusion server at his custom tags directory. The default IIS 404 message will quite happily serve up a template telling anyone who cares to look where your webroot is, and half the other details of your server.

Begin by opening the IIS management console. Expand the list of websites in the left-hand pane of the console, and right-click on the icon for the website you want to customize. Choose "Properties" from the popup menu, and click the "Custom Errors" tab in the configuration window.

IIS screenshot

Enter the URL for the error template. At this point I was getting an error message "The path is not a local absolute path". The error is that windows is looking for a UNC path, so it needs a proceeding forward slash.

Specify a 404 location

A few points to note in your custom 404 templates.

  • Keep it simple. It isn't part of your site, its an error handler and should not really feature any functionality.
  • 404 might mean something to us, but it probably wont to most users. Is there really any reason to display 404 all over the page?
  • The url will be relative from where the error was thrown so hard code any url values used. IE CSS images or links to anywhere.
  • Add logging. Either Google Analytics tracking, or what ever tracker you use. I also like to drop a cfmail request in there so that I know its gone wrong.

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
roof's Gravatar The path is not a local absolute path". The error is that windows is looking for a UNC path, so it needs a proceeding forward slash.
# Posted By roof | 14/10/2015 06:23
Attorney's Gravatar where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style.
# Posted By Attorney | 18/10/2015 02:44
Thomas's Gravatar Everyone enjoying with this blog provided http://www.customessayservicesreviews.com/us-presi... informative services. These are all using to develop more essays for college students and custom essay writers and thank you.
# Posted By Thomas | 02/11/2015 05:18
Jimmy Kim Build My List 2.0's Gravatar The error is that windows is looking for a UNC path, so it needs a proceeding forward slash.
# Posted By Jimmy Kim Build My List 2.0 | 07/11/2015 23:52
informative post's Gravatar I was helping a friend setup a custom tag path on his server demonstrated this. He couldn't remember where the web root was to point ColdFusion server at his custom tags directory.
# Posted By informative post | 13/12/2015 21:50
Adverse Side Affects Lawsuits - Xarelto's Gravatar ssss
# Posted By Adverse Side Affects Lawsuits - Xarelto | 19/12/2015 02:08
Assistance's Gravatar Great Post This is also a very good post which I really enjoyed reading. It is not everyday that I have the possibility to see something like this..Thank You!
# Posted By Assistance | 21/12/2015 02:17
cheap assignment writing help's Gravatar Firstly create a CurrencyFormatter object, and specify the currency symbol, and any other formatting parameters that you require.
# Posted By cheap assignment writing help | 26/12/2015 02:10
read here's Gravatar Good to become visiting your weblog again, it has been months for me. Nicely this article that i've been waited for so long.
# Posted By read here | 28/12/2015 01:42
read here's Gravatar Your site and show the kids check out up here generally. I m fairly positive there likely to be informed a great deal of new stuff here than anyone.
# Posted By read here | 29/12/2015 00:24
supreme garcinia cambogia and pure slim cleanse's Gravatar Great post! I am actually getting ready to across this information, is very helpful my friend. Also great blog here with all of the valuable information you have. Keep up the good work you are doing here.
# Posted By supreme garcinia cambogia and pure slim cleanse | 05/01/2016 23:41
DUI Lawyer's Gravatar I have feel that this blog is really have all those quality that qualify a blog to be a one.I wanted to leave a little comment to support you and wish you a good continuation.
# Posted By DUI Lawyer | 19/01/2016 23:53
taxi in ajmer's Gravatar The error is that windows is looking for a UNC path, so it needs a proceeding forward slash
# Posted By taxi in ajmer | 04/02/2016 02:03
Back to top