URL routing in ASP.NET MVC

What is Routing: Routes maps controllers names and their actions names. It is used to create user friendly URL.It can be also use to setup startup page of application just like ASP.NET web forms. the routing system lets you create any pattern of URLs you desire and express them in a clear and concise manner.

 

Map Route Functions. It has collections of routes and invokes routes.

Need of Routing

Old URL pattern

www.OnlineShop.com/Mobiles.aspx?catId=8

www.OnlineShop.com/Mobiles.aspx?catId=9

www.OnlineShop.com/Mobiles.aspx?catId=15

pasting

How to use Auto Refresh Web parts in SharePoint 2010

www.OnlineShop.com/Mobiles/Samsung

www.OnlineShop.com/Mobiles/Motorola

www.OnlineShop.com/Mobiles/Micromax

Benefits 

1. SEO friendly Application : Simplify URL

2. Non hackable URL’s: It’s not returning actual file name. No physical file

3. Prevents from inaccessible and secured files access

4. Ignore routes are used to prevent specific routes like web.config, XML file, Image file etc.

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

Ebook Download
View all
Learn
View all