Solution to the session loss problem after Asp.net 2.0 uploads files

Source: Internet
Author: User
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.

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.