Wednesday, July 28, 2010

URL Mapping in ASP.NET

In an ideal world, we'd design our Web applications perfectly the first time. Pages would be created in the proper folder and stay there. For that matter, end users would never care about the URLs of the pages in our Web applications, so we could put pages anywhere we wanted without worrying about it.


Url mapping is done in the system.web section of the web.config file.

an Example of url mapping is described



What does this mean?
         it simply means if we write a code   Response.Redirect("Default2.aspx")in Default.aspx page, the URL reads as Default2.aspx but the browser displays the page Default.aspx since the Default2.aspx page is  mapped to Default.aspx.


This are the basics of url Rewriting and Routing procedures done in MVC architecture. This all helps in SEO a lot...
We can enforce the folder structure using URL mapping...








5 comments:

  1. Is there any way that we can dynamically change mapped url?

    how can we add folder name url
    for eg : there is a url

    www.mysite.com?id=12345&cid=abcdef

    i want to make url something like this

    www.mysite.com/xyzpqr

    ReplyDelete
  2. ya for that u need to go for MCV routing Tabel

    ReplyDelete
  3. Passing of values from one page to another through query string will work normally? Or any special methods for query strings for mapped urls?

    ReplyDelete
  4. ya There are Special methods i will come with that. Or manually u can ass the Query string also to some session varaiable and go for this too...
    Thank u Sobin

    ReplyDelete