Please explain me about URL routing in MVC with example and some figure.
What is URL routing in MVC?
61722-Jan-2020
Updated on 22-Jan-2020
Home / DeveloperSection / Forums / What is URL routing in MVC?
Please explain me about URL routing in MVC with example and some figure.
Nishi Tiwari
23-Jan-2020For example, instead of ‘http://www.mindstick.com/forum/155738/what-is-validation-in-mvc’, we have ‘https://www.mindstick.com/forum/155739/define-viewbag-in-mvc’
How routing fits in an MVC application.
There are two type of routing in MVC
Convention based routing:
In below figure, the default method that add routes to the route table which is located in the RouteConfig.cs file in the App_Start folder.
In the above image, we can see three things: “routes”, “IgnoreRoute” and “MapRoute”.
Routes : It is nothing but only a table which is a collection of routes defined in the routing table. When anyone hits some URL in the browser, an application first checks the existing route tables and match with routes.
Attribute-based routing