views:

59

answers:

1

I read in http://support.microsoft.com/kb/298408 that IIS6.0 automatically responds with a "courtesy redirect" (HTTP 301) on URLs that lack a dot.

When a browser requests a URL such as http://www.servername.de/SubDir, the browser is redirected to http://www.servername.de/SubDir/. A trailing slash is included at the end of the URL.

Internet Information Server (IIS) first treats SubDir as a file that it should give back to the browser. If this file cannot be found, IIS checks to see if there is a directory with this name. If a directory with this name exists, a courtesy redirect with a 302 "Object moved" response message is returned to the browser. This message also contains the information about the new location of the directory with the trailing slash. In turn, the browser starts a new GET request to the URL with the trailing slash.

How does this behavior intersect with a framework like ASP.NET MVC, which employs URLs that do not require or use dots, in general?

Specifically... does ASP.NET MVC "turn off" this feature of IIS6.0 when installed? If so, how?

I would guess that is not the case, but instead the request routing done in IIS sends the request to ASPNET before performing the redirect. If someone could explain, I'd be grateful.

+1  A: 

The routing engine in ASP.NET MVC allows you to use extensionless routes in your application. You could configure IIS 6.0 to handle such URLs by making a wildcard mapping which would associate the aspnet_isapi filter with all requests meaning that everything passes through the ASP.NET engine for processing.

When installed on a server with IIS 6.0 ASP.NET MVC does not do any modifications to the IIS metabase meaning that extensionless routes won't work.

My recommendation would be to use extensionless routing only on IIS 7 and higher and have some extension (like .mvc) for IIS 6.0. This avoids the wildcard mapping and the possible performance hit for having the ASP.NET engine serving even static files like images, css, javascript, ...

Darin Dimitrov
I know that some people have used .mvc, and then applied a URL rewriter for IIS6, like IIRF (http://iirf.codeplex.com) to get the same visual effect, without the perf hit on static files.
Cheeso