top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is MVC routing?

+5 votes
302 views
What is MVC routing?
posted Mar 14, 2014 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Example:
Consider the below URLs:
www.myproducts.com/electronics.aspx?catId=8
www.myproducts.com/electronics.aspx?catId=9
www.myproducts.com/electronics.aspx?catId=15

The above URL’s appears to be just perfect for us and syntactically they are, but thinking from the end user’s perspective which product URL you think he will remember more than the others. I could say none of the above URLs. We are after all humans and we are more likely to remember words than numbers. So all the above URLs are the same for the end user.

Wouldn’t it be nice if we have URLs like:
www.myproducts.com/electronics/products/mp3
www.myproducts.com/electronics/products/tv
www.myproducts.com/electronics/products/laptop

The above URLs seem self explanatory and the user can easily guess that if we sell CDs he just have to append cd at the end of the common URL

These types of URL’s are called hackable URL’s and it is one of the advantages of using routing . Above example might have given you some idea about routing. Now we can say that "routing decouples the request
handler from the URL request" as in the example above.

answer Mar 15, 2014 by Atul Mishra
...