views:

35

answers:

1
+1  Q: 

ASP.NET MVC Areas

I want the follow URLs in my MVC application:
/Admin/Accounts/Groups
and
/Admin/Accounts/Users

I know i could create an area named Admin,and then create Groups and Users controllers inside that area.

Can i create "nested areas" to accomplish that full URL above? i.e: An area Admin,and inside this area another area named Accounts?

+1  A: 

To accomplish your desired URL above, just specify it in the route configuration of your "Admin" area like this:

public override void RegisterArea(AreaRegistrationContext context)
{
    context.MapRoute(
        "Admin_default",
        "Admin/Accounts/{controller}/{action}/{id}",
        new { action = "Index", id = UrlParameter.Optional }
    );
}

No need to create Groups or Users controllers.

Steve Michelotti