Thursday, September 15, 2011

IIS 7.5 – a breaking change in extensionless URIs handling after Windows Server 2008 R2 SP1 is applied

One of our sites use dynamic URL rewriting based on catching the 404 by IIS and executing an *.aspx webpage which then handles dynamic URLs accordingly.

This has been working for us for many, many years, starting on IIS 6 on Windows Server 2003. All request of the form

http://oursite.com/this/is/something/dynamic/foo.bar

and

http://oursite.com/this/is/something/dynamic/foo

were routed to the *.aspx page handling the 404 status code. ASP.NET has then been asked by IIS to process (respectively):

The404Page.aspx?404;http://oursite.com/this/is/something/dynamic/foo.bar

and

The404Page.aspx?404;http://oursite.com/this/is/something/dynamic/foo

When the SP1 is applied to Windows Server, IIS starts to behave differently. When a request regards a resource which contains an extension (like .bar, .jpg) the semantic is exactly the same as it has been before.

However, when a request to a resource without an extension is made(nonexisting folder like /this/is/something/dynamic/foo), IIS routes such request directly to ASP.NET like it is the ASP.NET responsible for handling extensionless uris. Instead of The404Page.aspx?404;… ASP.NET handles then

this/is/something/dynamic/foo

I presume this has something in common with the ExtensionlessUrl-Integrated-4.0 module and will inspect this further. What’s interesting is that the change affects only ASP.NET 4.0 while ASP.NET 2.0 is not affected.

It seems that it causes the trouble for other people too.

2 comments:

Anonymous said...

We are experiencing a similar issue were you able to resolve this?

Anonymous said...

We resolved this by adding the following to our web.config file:



Please see the following for more info:
http://stackoverflow.com/questions/11633611/iis-7-5-a-breaking-change-in-extensionless-uris-handling-after-windows-server