How to deal with different web applications for a site development

xiaoxiao2021-03-06  63

In the team development, how to deal with a site different web application General sessions is distressed by the different web projects of the same site for a while, 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 SESSION site to deal with the virtual directory setting, as shown below: (Figure 1, delete the virtual directory of the application, note that you 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 for team development, using VS.NET development site Different items General session write a simple presentation: Prerequisites: There are two web applications WRITESession, 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, then other web projects such as Row Lie User information, in another Web Project ReadSession 1, put two web projects in the same solution, such as: webtest; (This doesn't have to demonstrate, create a new blank solution, then add the existing Web Project to this solution) 2, create a new web project, this project is a web project of the entire site, no need to include this site Several web projects, if you look down from the solution browser as follows: (Figure 2 Although the ASPX file under ReadSession Writerses is part of the web project of GHJ1976.9cbs.net, but there is no column under its work, so that this is achieved A function of a number of sites, you can see in a later configuration, the ReadSession Writersession is released.) 3. Remove the virtual directory configuration of ReadSession and WritersSions as shown in the map. 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, increasing the reference to the ReadSession Writations two web projects in GHJ1976.9CBS.NET Web project, Note: It is an engineering reference, not other references to see the picture below (Figure 3 These three web projects are in the same Inside the solution, you can implement the project reference) 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 Watch: New Solutions, this solution only contains one of the web projects such as: readsession, modifying code, generating solutions, you will find that the execution will be modified. 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.

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

New Post(0)