Virtual Classes
Read Anytime,Anywhere
Home
Knowledge
English
Grammar
Essay
हिंदी
व्याकरण
निबंध
Physics
Computers
MVC
Oops
JQuery
C++
ASP.NET
Interview FAQ
Download
Contact Us
Model
View
Controller
Layout Page
Partial View
Razor View Engine
Model Binding
Bundling In MVC
Routing in MVC
Request Life Cycle
ViewData\ViewBag
Filters
Routing in MVC
Routing in MVC is a pattern matching mechanism.When browser makes a request of a MVC application. then URL Routing module of MVC first get the requested URL and check if these is any matching pattern is written in RouteConfig.cs file. RouteConfig class has RegisteRoutes method which has all the pattern specified to handle the request. If any matching pattern is found then request will be processed according to the matched pattern.
Below example shows registering of URL pattern.
You can add many route according to your requirement , how you want to process your request. But if URL Routing module finds a matching pattern then it does not look for other matching pattern available/registered in RouteConfig.cs So write your generic pattern at the last and specific pattern at the first.