Friday, June 15, 2007

ASP.NET 2.0 - URL Mapping

ASP.NET 2.0 provides features supporting "vanity url's" or "friendly url's". These are useful when you want to distribute simple url's to customers.

Say for instance you have an online store, offering a new product to a segment of customers. The path to the catalog item is
But you'd like to distribute a simpler url:
URL Mapping makes this possible. The following is a much simpler example. Note that it just happens to use the location appSettings overrides described in an earlier blog.
The highlighted section specifies the url mapping. The vanity url's (Diablo_Config.aspx and Diablo_Config.aspx?loc=test) are actually just as complicated as the actual paths (testconfig.aspx and test/testconfig.aspx), but it illustrates what's possible. The following screenshots illustrate what the "customer" sees:

The aspx page that outputs the appSettings is simply copied to the application root and /Test folder for illustrative purposes. If you're interested in aspx (not code-behind) that references app settings, see the following link.


Anonymous said...

What namespace is required to use the ConfigurationManager ?

Diablo said...

The System.Configuration namespace. In VS.NET 2005, you have to add the System.Configuration.dll as a reference.

Anonymous said...

How about I don't add a reference but only mention at the top of my .cs file as

using System.Configuration

Will it work ?


Diablo said...

In my version of VS.NET 2005, it will not work :).

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.

sex shop said...

It cannot have effect in actual fact, that is exactly what I think.

price per head said...

Great site!!! this information really helped me