Articles: 843 | Categories: 148   
   
   
Home Articles Contact Us
 
 
 
 
How to use URL mapping in ASP.NET 2.0 and VB.NET (0 Comments)
Admin: Posted Date: April 4, 2010

This tutorial will show you how to use URL mapping technology in ASP.NET 2.0 and VB.NET.The URL mapping feature uses configuration information stored in web.config to remap incoming requests to a different URL.

How to use URL mapping in ASP.NET 2.0 and VB.NET


This tutorial will show you how to use URL mapping technology in ASP.NET 2.0 and VB.NET.

The URL mapping feature uses configuration information stored in web.config to remap incoming requests to a different URL. The remapping occurs prior to any other processing for the inbound request. Although the sample below demonstrates remapping a page request, any arbitrary file type can have its request remapped to a different URL.

At first you need to build a sitemap file Web.sitemap.


 

Yes, it is possible to find a good web host. Sometimes it takes a while. After trying several, we went with Server Intellect and have been very happy. They are the most professional, customer service friendly and technically knowledgeable host we've found so far.

Secondly, please build a web.config file. The code is as following::

url="~/News.aspx" mappedUrl="~/UrlMappingVB.aspx?category=news" />
url="~/Category.aspx" mappedUrl="~/UrlMappingVB.aspx?category=default" />
url="~/Games.aspx" mappedUrl="~/UrlMappingVB.aspx?category=games" />
url="~/Health.aspx" mappedUrl="~/UrlMappingVB.aspx?category=health" />

We used over 10 web hosting companies before we found Server Intellect. Their dedicated servers and add-ons were setup swiftly, in less than 24 hours. We were able to confirm our order over the phone. They respond to our inquiries within an hour. Server Intellect's customer support and assistance are the best we've ever experienced.


 

The front end UrlMappingVB.aspx page looks something like this:


The current virtual path for the request is: <% Response.Write(Request.Path)%>.


The value of the category querystring variable is: <% Response.Write(Server.HtmlEncode(Request.QueryString("category")))%>.


However, the original path that was requested before it was remapped is: <% Response.Write(Request.RawUrl)%>.

 

 

 
 
Add a Comment:
 
(You must be signed in to comment on an article. Not a member? Click here to register)
   
Title:

Comments: