URL mapping is often used to provide "friendly" URLs, which are URLs that are more readable and sensical
-
Beverages.aspx
is a "friendly" URL as it is more readable than ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages
. URL mapping also is useful when restructuring a site. but the higher-ups want the products rooted available through
http://YourSite.com/Catalog/...
instead. Clearly, any users who have the old links bookmarked or linked from a website will get 404s if they visit once the folder name change has been made. This can be mitigated by using URL mapping to map each page in
the
Products
folder to its corresponding page in Catalog
. 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.
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.
config file will be tedious. To overcome this we can build a URL rewriting module using Regular expression.
Need To Increase Your ClickBank Traffic And Commissions?
ReplyDeleteBannerizer makes it easy for you to promote ClickBank products by banners, simply go to Bannerizer, and grab the banner codes for your chosen ClickBank products or use the Universal ClickBank Banner Rotator to promote all of the ClickBank products.