How to create a new sub-website and discuz Project Sub-website Technology in the solution

Source: Internet
Author: User

In. in the discuz project of net, the background management module is discuze. web. admin is a separate module. However, the folder for opening the solution cannot find the folder for separate modules, but is stored in discuz. in the admin folder of the web project.

After analysis, the original administrator module is a sub-website, just to build the website in the discuz. web folder, and finally, include the discuz. Web project. What are the advantages of a sub-website? It is very simple, that is, convenient management and independent development. When there is a problem with this module, compile this module separately, then re-upload the page file and DLL to the bin folder of the main website, which is completely unaffected.

Official statement: the management module is an independent module for convenient management... (to be verified, refer)

Discuz. web. admin is a class library, not a web application. The class library is not fully automated when adding the ASPX page, you can only manually enter and associate the page design file (we haven't found out how the official website is added yet ). And in discuz. the admin folder of the web project only contains the aspx file and does not contain the CS file. In this way, when a website is published, discuz is automatically released. web. admin Project (I still don't understand how to include only aspx files and not CS files ).

Sub-websites have the advantages of convenient management, independent modules, and complementary interference. Disadvantages: you cannot use global files such as Web. config and Global. asax that contain sub-websites. They can only be shared with the primary website, but you can create a new file in another folder and call it separately.

Because the project is developed based on vs08, the features of some development tools cannot be verified. (The reason is that my machine is not equipped with 08-snapshot)

The above is an analysis of the sub-website creation technology of the discuz.net project.

Next, we will use vs2010 to create a new sub-website. In 10, I changed the practice. The sub-website does not need a class library to implement it, but uses a web application to implement it, the advantage is that you can easily create An ASPX page without manual creation and the class libraries are all referenced.

First, create a web application named sitecollection.

Create a new website Web application named site. Note that the path of the project must be saved in the root directory of sitecollection.

 

Add a reference to the site in the sitecollection Project

Finally, click "show all files" in the sitecollection project. I don't need to use discuz here. I don't include files. Because they are included, every time I create a page, they will be included in the main project, which is inconvenient, why don't I include it? Copy it directly to the directory of the main website when publishing a sub-website, which is convenient and easy to use.

This should be the built-in example of the newly created vs10, so it will contain the Web. config and Global. asax files, and I have killed it. Otherwise, an error is reported.

Run the test:

Note the URL path:

Succeeded.

Next let's try to call the content of web. config of the main website:

In the default. aspx. CS file of the sub-website of the site, write

Also succeeded:

Remember, you must debug and view the webpage on the main site.

Finally, if the Sub-website project of the site has changed, directly select the site project compilation and release, obtain the DLL and page files, and upload them to the corresponding directory of the main website. Very convenient.

Finally, the project example is attached: XXX

The above are my personal opinions and errors. Finally, I would like to thank you for your support. Bytes

 

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.