Home

Thursday, 7 July 2016

Configuration of Routing in ASP.Net MVC Application

All MVC Application at-least configure route in RouteConfig.cs class. In MVC application have App_Start folder.this folder contain RoutConfig.cs class.
below snapshot show the RoutConfig.cs file structure.

As in above figure url Pattern is-
url:{controller}/{action}/{id}
where {controller} is class name, {action} is given class method name and {id} is a parameter name
Example-
url:home/index/30

Configure Multiple Route in Application-
In Application we can configure Multiple Route.



We can configure Multiple route using different parameter and action name,MVC Application read sequentially configure route if given URL not matched with this path then its read second URL etc. if not matched first one then its open default URL.

No comments:

Post a Comment