URL Rewriting in .Net 2.0

I was familiar with URL Rewriting from a previous project in 1.1 which required a dll ThunderMain.URLRewriter.dll (code project article about this).

My initial requirement for using in my latest project is to allow simple state name replacements like root/Florida go to detail.aspx?state=FL and the URL Rewriting in .Net 2.0 does this nicely and is case insensitive. Ideally I want to add the URL entries programmatically so it will auto generate variations like FL or FLA for Florida and GA for Georgia.

Some useful links:

General Use
http://www.developer.com/net/asp/article.php/3581326
http://www.codeproject.com/aspnet/urlrewrite.asp

Adding RegEx
http://pietschsoft.com/blog/post.aspx?postid=762

Open Source (seems complicated to use...)
http://urlrewriter.net/

Update: Since trying the 2.0 URL rewriter I've learned that you can't use folder names only to redirect to a page. It works while using the built in webserver that Visual Studio 2005 uses during development because it handles ALL requests. However when you move your project to a live server that uses IIS it fails because there is no default handler for the empty pages (ie. folder). To get around this you have to do some fancy stuff in the Global.asax. My advice is to use ThunderMain url rewriter or the URLRewriter.net tool. This is disappointing that Microsoft didn't think we would want folders redirected to pages. But I'll take .Net 2.0 over ASP and especially 1.1 anyday.

No comments:

Post a Comment