Menu
Categories
Routing in MVC?
June 8, 2017 MVC

Hi All,

Routing helps us to give user friendly URL structure. Helps to map those URL structure to the controller.When any user types “http://localhost/View/ViewStudent/” , it will goes to the “Customer” Controller and invokes “DisplayStudent” action. This is defined by adding an entry in to the “routes” collection using the “maproute” function.

routes.MapRoute(
"View", // Route name
"View/ViewStudent/{id}", // URL with parameters
new { controller = "Customer", action = "DisplayStudent", id
= UrlParameter.Optional }); // Parameter defaults
Leave a Reply
*