Routing in MVC?

By | June 8, 2017

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

Your email address will not be published. Required fields are marked *