views:

12

answers:

1

I create a new project and start it. It turns out that the controller Home is called with the action is default i.e. Index - this means Controllers/HomeController.Index() is called. The view displayed by this action is defined in this method - i.e. Views/Home/Index.apsx.

I want to change this starting behavior to be another controller and action. How can I do this?

A: 

Open the file Global.asax.cs and look for the line

        routes.MapRoute(
            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
        );

There, change Home and Index to the your choice's values. Hope that helps!

Nam Gi VU