Partition project,

Source: Internet
Author: User

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 "}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.