URL Mapping ASP.NET 2.0!

In this blog post, i will show how to map urls in your ASP.NET application. Suppose you have a link to an aspx page which has a long guid name. To make it simple for you to use is to map this url into a simpler one.
First you need to enable this feature from the web.config file in your application folder by adding under the <System.Web> tags the below

 <urlMappings enabled="true">
   <add url="~/Test.aspx" mappedUrl="Default-guid-1232-1233-44431-3223.aspx"/>
 </urlMappings>

If you don't have an aspx page called "Default-guid-1232-1233-44431-3223.aspx", Create one to continue with this demo.

Now Open Default.aspx page, on button_click event write the below code
Response.Redirect("~/Test.aspx");

Run Default.aspx, click the button, you will see that you are being redirected to Default-guid-1232-1233-44431-3223.aspx WebForm.Eventhough we didn't have a physical file called "Test.aspx".


As you saw, Using url mappings is straight forward and easy to use.

Hope this helps,

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.