Use ASP. net mvc Area-set Area to an independent project, mvcarea

Source: Internet
Author: User

Use ASP. net mvc Area-set Area to an independent project, mvcarea

Environment Description: Vistual Studio 2013

MVC 4.0

In fact, the basic knowledge about ASP. net mvc Area can refer to the soft article of http://www.cnblogs.com/willick/p/3331519.html.

The Application_Start method in Global. asax contains the following code:

AreaRegistration.RegisterAllAreas();

It is estimated that its function will dynamically inject the AreaRegistration class in the bin where the current MVC is located. This class configures the partition routing. therefore, when "partition" is independent from the current MVC Project ", find a way to save the dll compiled by this partition to the bin directory of the current MVC application.

Note: 1). The HealthDemo. Web. Admin project type is a class library, and its actual physical path is still under the HealthDemo. Web directory. For details, refer to the following

Manually change the HealthDemo. Web. Admin file of the Class Library Project HealthDemo. Web. Admin. csproj, and save the edited dll in the HealthDemo. Web \ bin directory.

Basically, the program should do things.

You can generate the corresponding url with partitions, and find that a request in the admin/controller/action form can be sent to HealthDemo. web. admin. controllers corresponds to the Controller, but the controller does not find a view that has been independent from the "outside". The actual physical path of this view file is in HealthDemo. under Home in Web \ admini\ \ Views, we need to reset the URL of the MVC search template.

Through this small experiment, I feel the settings of ASP. NET MVC 3 Area (partition) and Page Template loading search path.

Project Demo: http://yun.baidu.com/share/link? Consumer id = 1654488135 & uk = 118268666

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.