Articles → .NET → URL Mapping In ASP.NET

URL Mapping In ASP.NET











http://Yoursite/ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages




http://Yoursite/Beverages.aspx





Implementation




  1. Add urlMappings tag in web.config file inside system.web tag.
  2. Set enabled attribute of urlMappings tag to true.
  3. Put add tag as a child tag of urlMappings.
  4. Add url as an attribute of add tag. If we consider the example which I have mentioned earlier "~/Beverages.aspx" will be the value of url.
  5. Add mappedUrl as another attribute of add tag.In the above example "~/ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages" will be the value of mappedUrl.

Code


<configuration>   …
  
	<system.web>		  
      …
        
		<urlMappings enabled="true">
			<add url="~/Beverages.aspx" mappedUrl="~/ProductsByCategory.aspx?CategoryID=1&CategoryName=Beverages" />
		</urlMappings>	   
       … 
  
	</system.web>
  …

</configuration>




Posted By  -  Karan Gupta
 
Posted On  -  Monday, November 15, 2010

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250