404 URL Rewriting with IIS7

13 03 2008

This purpose of this post is to expose an issue(?) in IIS7 in the context of 404 URL rewriting.

To set up URL Rewriting in IIS 7, you basically go into the settings for your website, go to the custom error pages tab, double click 404 and set it to ‘execute url’ and provide it with a root-relative path to your aspx page, which is going to handle the actual 404 request, extract the path you requested, and rewrite appropriately.

The issue is, if you use any type of url encoding (ie /my%20site/blah.aspx) inside the execute url – it will not work, and will produce you a 400 invalid request.  You must make sure you remove all url encoding (ie, this works: /my site/blah.aspx)

That’s all :)


Actions

Information

Leave a comment