ts0

ts0

third solution

follow me on Twitter!

Extension-Less URL Rewriting in IIS6 without 3rd Party ISAPI

That title is a bit of a mouthful, but it sums up the issue. Everyone seems to be talking about hackable URLs these days, and it kind of feels like the RoR guys are laughing at us ASP.NET people. It's just such a pain to get it to work right in ASP. They added the RewritePath method which you can call in a BeginRequest handler to redirect the request to a certain script and add on any querystring you want, totally transparent to the user. It's a good start.

The problem is that BeginRequest only fires for requests that come through to the ASP.NET engine, that means that IIS has to pick up on an extension like aspx which is mapped to that handler. So most examples of URL rewriting will offer a hackable URL like /shop/books/fiction.aspx, I can hear the RoR guys chuckling again.

After a lot of digging around I came across what seems to be a very little known solution, wildcard mapping. Basically you can add an application mapping to '.*' in the application config and all requests will go to the ASP.NET engine.

I found one little reference to this in some blog comments by Scott Guthrie, he said the problem with this solution is you can't override the default document on a folder, but if that document is aspx then it doesn't really matter!

Anyway, I saved myself $99 on ISAPI Rewrite, so I'm happy.

Labels: ,

4 Comments
ts0
Thom Shannon's background in making chips gives him a unique insight into the web development industry. As the Technical Director of Glow New Media he works with clients across the UK to deliver high quality web marketing solutions using the latest techniques, accessibility practices, and web standards in both straight and crinkle cut.


Download a vCard (for Outlook)

Friends



Find Me (and my Social Graph)



RSS Feed

Archives 08.06 09.06 10.06 11.06 12.06 01.07 02.07 03.07 04.07 05.07 06.07 07.07 08.07 09.07 10.07 11.07 12.07 01.08 02.08 03.08 04.08



Thomas Shannon-Smith
Tom Shannon-Smith
Tom Shannon
Thom Shannon-Smith