9 February 2013

Setting the Default Page or Route in MVC application

Setting the Default Page or Route in MVC application


For convenience, we are going to tell MVC that requests to the / URL for our application should be
directed to the Index action method of the Product controller. To do this, open the Global.asax file and 
find the RegisterRoutes method. In this method, there is a call to routes.MapRoute. Change the value 
assigned to the controller property from Default to Product,





Setting the Controller for the Default Route
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Product", action = "Index", id = UrlParameter.Optional }
)




No comments:

Post a Comment

Comments Welcome

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...