Explain What is routing in MVC? What are the three segments for routing important?
8309
14-May-2017
Manish Kumar
14-May-2017Routing define Url pattern and handler information. It is a mechanism to process the incoming url that is more descriptive and give desired response. It is the URL pattern that is mapped together to a handler and routing is responsible for incoming browser request for particular MVC controller. We can also say that routing help you to define a URL structure and map the URL with controller.
Routing are of two types (after the introduction of ASP.NET MVC5)
Convention based routing: We can call MapRoute method and set its unique name, this url pattern and specify some default values.
Attribute based routing: In attribute based routing we specify the Route attribute in the action method of the controller.
There are three segments for routing that are important
1-ControllerName
2-ActionMethodName
3-Parammeter