URL Mapping is a mechanism by which you can change the displayed url in address bar.
Example:
Your asp.net application is developed from years, with convention frm as prefix to webform.
Now to change already assigned name to legacy system which is maintained for past few years and to avoid risk we can make use of URL Mapping.
For URL Mapping
Step1: Add Mapping URL in web.config file.
<system.web>
<urlMappings enabled="true">
<add url="~/Department.aspx" mappedUrl=" oldforms/frmDept.aspx"/>
<add url="~/Employee.aspx" mappedUrl=" oldforms/frmEmployee.aspx"/>
<add url="~/Product.aspx" mappedUrl=" oldforms/frmProduct.aspx"/>
</urlMappings>
</system.web>
Step2: Change the URL in .aspx file
<a href="Department.aspx">Department</a><br />
<a href="Product.aspx">Product</a><br />
<a href="Employee.aspx">Employee</a>
Step3: Now Check your ugly looking URL, it is replaced with New desired URL.
Before URL Mapping
After URL Mapping
3 comments:
Hii,
Your concept is good but one can access the page with the name "Department.aspx" also with the name frmDept.aspx. So where is the security for url ???
Thanks,
Navin C
Use URL Rewriting Approach
http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.html
Thanks 4 help.
But if we have to show the list of visited pages & go back to any page then how to do this? plz tell me.
Post a Comment