ASP.NET 2.0 URL Rewriting

Posted on

 Today I spent just 15 minutes in researching asp.net 2.0 URL rewriting functionality for my blog and found that it only support “hard coded” rewriting. I wanted to make my blog more search friendly. Unfortunately asp.net 2.0 is not supporting any dynamic parsing or parameters like regexp parsing. You can add rewriting by modifying web.config file of your application adding code below.

<urlMappings>
    <add url="~/category/toothpicks.aspx"
mappedUrl="~/displaycategory.aspx?Category=1"/> <add url="~/category/drinkumbrellas.aspx"
mappedUrl="~/displaycategory.aspx?Category=2"/> <add url="~/category/fancypants.aspx"
mappedUrl="~/displaycategory.aspx?Category=3"/> </urlMappings>

By searching web and I found tons of examples of regexp rewriting, especially I liked Scott Mitchell MSDN article
URL Rewriting in ASP.NET with code examples.This article has been written before ASP.NET 2.0 release, so for me it’s a little disappointment why guys from asp.net team didn’t use the same approach in their 2.0 bits.