tags:

views:

42

answers:

2

admin section is at www.example.com/admin

so I have an admincontroller.

But I also have user admin related controllers, and configuration controllers, I want the url to be like:

www.example.com/admin -> adminController

www.example.com/admin/user/ -> adminUserController www.example.com/admin/user/edit www.example.com/admin/user/add

  1. I hate the name AdminUserController, any suggestions?

View pages are organized like:

/views/admin /views/admin/user/

so in just manually reference the view page like return View("~/views/admin/user/add");

What other options do I have?

+3  A: 

You can use multiple areas in the same project (in MVC 2). You could have an admin area. This lets you organize all the controllers in a sensible way, and fixes the naming issue: You'd have a "UserController" in the "Admin" area.

Craig Stuntz
+1  A: 

There is no direct relation between the Controller/Views Name and physical location and your Route, you can control this in the Global.asax, If you have an AdminController you can define a Route like

example.com/Admin/Manage/

In your Global will be like :

routes.MapRoute(
                "AdminSection",
                "Admin/Manage/{action}/{id}",
                new { controller = "AdminController", action = "Index", id = "" }
            );

So when a Route like this example.com/Admin/Manage/ is entered you redirect to the desired controller and action, the name of the controller is not strictly the one on the route. Hope it Helps.

Omar