Partition project,
A project can be divided by function, such as the foreground and background
Right-click the MVC project and choose add region.
Generate an Area folder to preferentially load the route of the partition Project
1. Error: http: // localhost: 65530/home/Index
The "home" request finds the following matched controllers:
BookShopMVC2.Controllers. HomeController
BookShopMVC2.Areas. Admin. Controllers. HomeController
Use namespace
(1) Route registration:
First register the partition route:
URL: Admin/{controller}/{action}/{id} // If you enter Admin/Home/Index, it matches the namespace.
DataTokens:
Namespace: "BookShopMVC. Areas. Admin. *"-> If a route change is matched, the Controller in the Namespace is used.
Register an out-of-partition route:
URL: {controller}/{action}/{id}
DataTokens: by default, there is no explicit control (the key length is blank)-> Search For All controllers under the project, and finally find multiple HomeCnotroller
Solution: Add a namespace ******* outside the partition *******
Namespaces: new string [] {"bookShopMVC2.Controllers "}