Failure to set the default controller in the MVC 2 RC area

It should be simple, but alas ...

I created an Admin scope in my MVC 2 project (separate project areas). I created a pair of controllers and their respective view folders. In the AreaRegistration.RegisterArea method, I specified that I want the default controller to be "Dashboard":

public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "Admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "Dashboard", action = "Index", id = "" }, new string[] { "Admin" }
        );
    }

If I go to url / admin / dashboard, the index fits just fine. However, I want the user to be able to go to url / admin / and see the same thing. However, when I do this, I get "Resource not found."

I just pee with the MVC 2 Area implementation, and I don't think I'm doing something too complicated ... Did anyone have the same problem? Do I need to specify a separate route, possibly at the root level without an area?

+5
3

, . , "", , .., . ? "Admin" .

+1

:

        context.MapRoute(
            "Admin_default2",
            "Admin"
            new { controller = "Dashboard", action = "Index", id = "" }
        )
+1
context.MapRoute(
               "Admin_default3",
               "Admin/{action}",
               new { controller = "Admin", action = "Index" }
               );
0
source

All Articles