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.
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?
Aman: technically yes, but in most cases you dont want to rewrite all URLs, eg for files which actually do exist, so you wouldn’t want to pass those to your handler. Besides Microsoft would never do such a thing!
Thanks for post such as very useful and very lovely post…..
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