General site is divided into the front desk + members backstage + admin backstage, do webform people will put the member background page in the user, the admin background page in the admin
Member backstage visit:www.xxx.com/user/xxx.aspx
Admin background access:www.xxx.com/admin/xxx.aspx
But a lot of people go to MVC and don't know what to do.
In fact, MVC has already thought for us all, that is areas( region )
The following is an example of a news system:
1. Project right-add-zone
Description: A new folder has been added to the root directory areas, there is a admin,admin inside the MVC 3 folders and a Routing settings class
You can create a new controller and action in the admin, as if it were an MVC project.
2. Create a new controller in the zone admin
In Admin controllers right-click New Controller Newscontroller and then access http://localhost:8080/Admin/News/Create
3. New Zone User
Repeat steps 1th, 2 to create a new zone user, then right-controllers the new controller Newscontroller in user, and then access http://localhost:8080/user/News/Create
4. root directory New Controller
Due to business requirements, the root directory also needs to create a new controller Newscontroller, Access http://localhost:8080/News/Create
Description: Send error, everybody don't worry, this is because the route does not recognize multiple named controllers
5. Modify the routing RouteConfig.cs
Modify the routing RouteConfig.cs (in the root directory App_start folder) so that routing is performed based on the controller's namespace
6.
Access to 3 news/create are normal.
ASP. NET MVC Areas Zone description