Rewriting URL paths in ASP.NET 2.0 is referred to as URL Mapping. Instead of putting some code in your Application_BeginRequest method, you can now just put a few lines in your Web.Config file and like magic you can rewrite those URL paths with ease.

With URL Mapping you can turn a not so friendly URL like ~/Blog/Post/11/12/2005/145.aspx into ~/TheCoolestPost.aspx

Example Web.Config File:

<?xml version="1.0" ?>
<configuration xmlns="">

    <urlMappings enabled="true">
          mappedUrl="~/Default.aspx?category=default" />
          mappedUrl="~/Default.aspx?category=autos" />
          mappedUrl="~/Default.aspx?category=games" />
          mappedUrl="~/Default.aspx?category=health" />
          mappedUrl="~/Default.aspx?category=news" />


Since the Web.Config file is an XML document, you could add functionality to the admin section of your app to add/edit/delete custom URL Mappings. This is definitely something I'm going to keep in mind for future ASP.NET 2.0 app I design/build.

kudos to the ASP.NET team. This is just one of the many new features added to ASP.NET 2.0. And they couldn’t have made it any easier to use!

URL Mapping in ASP.NET 2.0:

If you want to see how to rewrite url paths with ASP.NET 1.x go here: