How to deal with different web applications for a site development

zhaozj2021-02-16  47

How to deal with different web applications for a site development

The previous period was distressed by the different web projects of the same site, with the help of 9CBS netizens, found a solution, and found some related articles online. However, these articles are not enough detailed. I put these related knowledge, so that I will find it later, it is convenient to encounter such problems in the future, don't find information, patch up the information.

The same site, the web application in different virtual directories cannot share session. The WEB project created by vs.net is an engineering a virtual directory, one project uses a set of own web.config and global.asax files so that we are developing a number of related items (via session sharing resources) It will encounter trouble.

It is not difficult to solve this problem, combine these projects into a virtual directory, as for web.config and global.asax, although a project can be configured, but recommend a full web site with a set of configuration, and the Web in different directories .config affects the configuration of the ASPX in different directories. If there is a web.config file in the root directory and a web application directory, but it is defined, sessionState mode = "Inproc" obviously these two applications are impossible to share .

Specifically, the following conditions can be achieved, you can achieve the same site session sharing.

1. You need to share the Sense site to go to the virtual directory setting, as shown below:

(Figure 1. Delete the application's virtual directory, note that click the delete button, not the uninstall button, delete your application directory file, I am not responsible)

2. Make sure the entire site has a web application must have something necessary, such as Web.config and Global.asax. The setting here is to be responsible for the entire site. A simple method can create a web application at the root of the site.

3. Delete each of the needs of the web.config and the Global.asax file in the general session site directory, such as the following boxes should be deleted in Roli's web.config.

Meet the above conditions can be universal session.

The following is a simple demonstration for the use of VS.NET development sites for different projects for team development.

Prerequisites:

There are two web applications Writestion, readsession at the same site. We want to demonstrate a session value in the Writestion web application, such as Session ["AAA"] = "123"; then read this session value in the ReadSession.

The above two projects are equivalent to the distribution of two people in large web development. It can be thus considered that WRITESession is to process user login, login information, log in to the session and then other web projects such as Row User information, in another web project ReadSession1, including two web projects in the same solution, such as: webtest; This doesn't have to be used to demonstrate, create a new blank solution, then add the existing Web project to this solution)

2. New web projects, this project is a web project of the entire site, and does not include several web projects under this site. If you look at the solution browser:

(Figure 2 Although the ASPX file under ReadSession Writers is also part of the web project of GHJ1976.9CBS.NET, but its work is not columns, so that the function of multiple projects is implemented, in a later configuration It is seen that readsession Writersession has been released in virtual directory.)

3. Remove the virtual directory configuration of ReadSession and WritersSions as shown in Figure 1.

4. Remove some settings in the Web.config file of the ReadSession and Writestion, delete those boxes mentioned above. (In order to reduce trouble, the easiest way is to delete two files directly to Web.config and Global.asax. So after the program starts to call these two profiles, which is GHJ1976.9CBS.NET this Web application Two files)

5. Increase the reference to the ReadSession Writestion two web projects in GHJ1976.9CBS.NET Web project, pay attention: is the project reference, not other references

(Figure 3 These three web projects are in the same solution, so that the project can be implemented)

Figure 2 can also see the two projects to GHJ1976.9CBS.NET project.

6. Generate a solution, run the program, you can see it, everything is OK.

If you want to release this program, the execution file only needs the file in the bin directory in the root directory.

Other pay attention to:

New solution, this solution only contains one of the web projects such as: readsession, modifying code, generating a solution, you will find that the execution will be modified after you have modified it. Haha, of course, will not be the same, this project is not a virtual directory, the execution file he calls is the file of the bin directory in the root directory, not the bin directory under this solution.

In the team development, Writestion can be seen as a public work that everyone wants to call. ReadSession can be considered to be the project that everyone is responsible, so that multiple projects in the team can share a session.

How to develop a lot of articles on the Internet, this is not repeated here.

Related information connection:

9CBS discussing this problem post:

Http://expert.9cbs.net/expert/topic/1773/1773115.xml

307467 How to: Create An ASP.NET Application from Multiple Projects for Team

http://support.microsoft.com/?id=307467

How to Share Session / Application State Across DiffERENT ASP.NET Web ApplicationShttp://www.asp101.com/articles/jayram/sharestate/default.asp

317786 How to: Manage Multi-Project Solutions in Visual Studio .NET

http://support.microsoft.com/?id=317786

转载请注明原文地址:https://www.9cbs.com/read-28360.html

New Post(0)