Secrets about ASP. NET Session expiration

Source: Internet
Author: User

The ASP. NET Session always expires. Later I found that the Session will be lost due to directory deletion and rename operations.

If you find that the session is suddenly lost for no reason, and when you carefully check the code and eliminate the possibility of other general loss, you may be close to a crash like me ~!

Later I found the problem was that I used code to create a temporary directory and then deleted the temporary directory.

Now I want to share with you the hope that it will be useful to friends who encounter similar nails ..

To put it bluntly, the essence of ASP. NET Session expiration is that the application restarts!

When will the application automatically restart?

That is to say, asp.net will monitor the application directory. Once any monitored action occurs, such as modifying the config or renaming the directory, the application will automatically restart.

Of course, your session will be lost.

If this operation cannot be avoided, for example, renaming a directory), here we can store the information or store it in the database with cookies;

Note: In addition to the English conditions listed above. Deletion of directories will definitely cause ASP. NET Session to expire. Asp.net's internal mechanism treats a directory a bit like a miser. It keeps a directory and you don't want to add it to it). Once you create it, it will monitor the directory, if you want to delete or rename its Directory), it restarts ..

  1. Summary of Solutions to ASP. NET Session Timeout
  2. Cause and solution of ASP. NET Session loss
  3. ASP. NET code hidden files
  4. Introduction to ASP. net mvc Framework
  5. Introduction to MvcAjaxPanel in ASP. NET MVC

Related Article

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.