Custom 404 handling with Sitecore / .Net

Ruben, one of my collegues is our usability guru. Well that’s actually not wholly true. Ruben ‘Usability’ Timmerman is next to a usability consultant, a Google-expert, a whizzkid and a cool collegue :). The guys of Team Nullsoft write down the strange stuff of each other on their website. I’ll try it to do the same for Ruben:

Ruben Timmerman
Adwording the internet
When you see Adwords, 90% chance they are plugged by Ruben. We found Ruben in the middle of the Netherlands(Utrecht), he moved in and never left us. Ruben works 24/7 while he listens to all different heavy kinds of music. Between Tech-House and Opera(altough he doesn’t like Ska!), everything was sent into the ether using Ruben’s wireless Headphone machine!

Ruben warnt me for the golden mistake made by 404-pages: forgot to respond the right 404-code!
Sitecore’s 4040 actually does what you expect from a 404-page. But when you customize your page you easily forget to set this code.

Based on if you handle errors within Sitecore pages or ouside of Sitecore this would do the trick:

//Inside Sitecore:
Sitecore.Context.Page.StatusCode = 404;
//Outside:
this.Page.StatusCode = 404;

What actually can happen? Well, Google, for example, offers Google Sitemaps an easy and free way to retrieve lots of information about accessing your site just for free! They ask you to create a page wso something does respond the code 200. When you can create a page, you definitelly hav enough rights to check out the stats Google offers. This exploit did exist at AOL.Com, Ebay, etc. So be aware of it…
Google actually solved this exploit, but it is this good to be aware of…

More information (in Dutch) by Ruben ‘Usability’ Timmerman.
More information by the guy who discovert it, David Naylor.

2 thoughts on “Custom 404 handling with Sitecore / .Net”

Comments are closed.