URL Mapping in ASP.Net 2.0
ASP.Net 2.0 provides a simple way to map a long URL to a short URL with the help of <urlMappings> tag in Web.Config. With this feature URL rewritting becomes simple but with some big limitations.
For example,
<urlMappings>
<add url="~/Csharp.aspx"
mappedUrl="~/Articles/Csharp/Default.aspx"/>
<add url="~/ASPNet.aspx"
mappedUrl="~/Articles/ASPNet/Default.aspx"/>
<add url="~/Framework.aspx"
mappedUrl="~/Articles/Framework/Default.aspx"/>
</urlMappings>
The above config settings routes the user to the URL given in mappedUrl property and thus makes the URL very simple and easily rememberable.
The drawback of this feature is when our websites grows drastically then maintaining this section in config file will be tedious. To overcome this we can build a URL rewriting module using Regular expression.
The following article will help you in building this module.
URL Rewritting with regular expression.
Happy Coding!!!