Multiple websites are stored on one VM.

Source: Internet
Author: User

Unlike ASP, Asp.net can place a program in a folder without interfering with each other. In order to enable a virtual host to store multiple Asp.net files, no answer is perfect, however, some materials have inspired me. Through thinking and practice, I have finally explored a new way to achieve a simple solution that can be proposed as a website or merged. At the same time, I would like to thank you for your help. Please refer to the implementation results:

My personal website: http://www.socan.com.cn/
Customer Management System: http://www.socan.com.cn/crm

First of all, I would like to mention the requirements for placing the website on the same Virtual Host:
1. File merging in the bin folder ensures that all websites can call the classes they need.
2. Topics under app_theme can be merged and will not affect each other.
3. The link in the file must be a relative path.
4. Pay attention to the inheritance relationship in Web. config.

First, because I only have one database, the table names are prefixed, just like. the tables in the. NET member qualifications have the same prefix as the ASPnet, and all websites are placed under the same solution. This is like a three-tier structure that is the union of various websites.

Second, themes in app_theme use different names on each website. If a website has multiple themes, you can use the prefix method, in this way, topics can be merged without errors.

Third, of course, we need to reconstruct the existing website, and change all links to relative paths. Note that CSS is relative to the current file, while JS is relative to the files used, the file to be used by the client control. The server control is relative to the current file. It is recommended that you do not use IIS for debugging during development, which reduces the chance of directly using the relative root directory path due to customary issues.

Fourth, the root directory must have web. config. do not conflict with the sub-directory. Remember to add the web in the sub-directory after the sub-directory is generated. remove the authentication, profile, membership, and rolemanager nodes of config.

With this method, as long as you pay attention to the above points during development, the space can be used rationally.

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.