URL mapping - a feature new to ASP.NET 2.0 - enables page
developers to map one set of URLs to another. If a request comes in for one of the URLs in the first set, it is automatically
re-mapped on the server-side. For example, you can configure the application so that the URL ~/Beverages.aspx
is mapped to ~/ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages. With such a mapping in place,
when a user enters http://YourSite.com/Beverages.aspx into their browser's Address bar, on the server-side
the request will be handled as if they had entered http://YourSite.com/ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages.
The user, however, will continue to see http://YourSite.com/Beverages.aspx in their browser's Address bar; they
won't know that the request was re-mapped.
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. Imagine that all product information was accessible through http://YourSite.com/Products/..., 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.
In this article we'll explore how to configure an ASP.NET 2.0 web application to provide URL mappings as well as look at
how URL mappings work underneath the covers. We'll also discuss techniques for implementing URL mapping in
ASP.NET version 1.x along with ideas for extending ASP.NET 2.0's URL
mapping feature. Read on to learn more!
Read More >