CraigWardman.com

[ IIS 6 Rewriting Problem with .NET 4 ]

/Blog/Post

IIS 6 Rewriting Problem with .NET 4

Recently I had a problem with a URL rewriting regular expression not picking up URL requests, resulting in 404 not found errors.

The expression was designed to pickup anything that consists of a string containing no dots (extensionless files). This is because I know these files exist only in a database and have a handler. It worked fine until one day it just didn’t.

After enabling logging in Helicon rewriter, I could see the original URL was not actually being passed through to the Helicon ISAPI filter and infact had already been modified to include ‘/eurl.axd/{hash}’ on the end. Hence why the regex was not making a positive match.

A quick Google revealed a change in ASP.NET 4 that seems to handle extensionless file requests slightly differently than before. It looks like .NET 4 is getting in early (ASP.NET never used to fire for non-mapped files, right?) and picking up the extensionless file and (maybe because its IIS 6) is rewriting the URL, as above, with the ‘/eurl.axd/{hash}’ part suffixed.

This was now causing a 404. To fix this I simply added a 2nd regular expression that would pick up these requests for extensionless files with aforementioned ‘eurl.axd’ suffix so that this will also pass to the database file handler.

Share This!

4 Comments to IIS 6 Rewriting Problem with .NET 4

  1. Aman's Gravatar Aman
    August 30, 2011 at 3:37 pm | Permalink

    We would just have to look out for any changes that Microsoft may make to the default rewrite. May be we can just, mod the regex to exclude anything after the last “/” whether is “eurl.axd” or any crap like that. Should work, shouldn’t it?

  2. August 25, 2011 at 11:41 am | Permalink

    Thanks for post such as very useful and very lovely post…..

  3. August 11, 2011 at 10:11 pm | Permalink

    I ran into a similar issue with v4.0 ASP.Net extension less URL feature on II6 and found a solution through ISAPI Rewrite Module provider, the does not require turning it off. Theissue and the solution as we experienced it is documented here http://www.vanadiumtech.com/OurBlog/post/2011/08/12/Cause-of-eurlaxd.aspx

Leave a Reply

*
CraigWardman.com
Car Leasing | Lease Cars