Microsoft's. NET 2.0 has the dynamic compilation feature. It monitors the site directory and automatically compiles it dynamically as long as we modify the source code. But it also brings about a problem. If we upload or delete a file, then the Web Application
ProgramIf the folder changes, the application will be restarted and the session will be lost.
There are many solutions, such as using cookies and saving the database temporarily. Here I recommend the most convenient solution without making any changes to the application.
However, the premise is that you have the permission to create a virtual directory under the site, and you can specify the virtual directory to the outside of the Web Folder.
For example, if the app's upload folder is/uploadfiles, you need to create an uploadfiles virtual directory under the web site in IIS and point it to another folder outside the Web Folder.
And delete the physical directory of uploadfiles under the Web
In this way, the session loss problem in 2.0 can be solved perfectly.