Summary of Solutions to ASP. NET Session Timeout

Source: Internet
Author: User

Recently, when I was working on an ASP. NET project, the test website could not retrieve the value in the Session. I searched online and found some solutions, which are recorded here. Finally, the problem is solved using the method stored in StateServer.

The TimeoutASP. NET Session of SessionState times out.

I. Some antivirus software will scan your Web. Config file. At that time, the Session will definitely drop. This is Microsoft's statement.

2: The program contains code that causes Session loss and insufficient server memory.

3. The program has a framework page and Cross-Domain Information.

The first solution to ASP. NET Session timeout is to prevent the antivirus software from scanning the Web. Config file (do not edit it when the program is running)

The second is to check whether the Code has Session. Abandon () or the like.

The third is to start ASP. NET State Service in the Window Service.

The following is the help content:

(Ms-help: // MS. VSCC.2003/MS. MSDNQTR.2003FEB. 2052/cpguide/html/cpconsessionstate.htm)

ASP. NET provides a simple and easy-to-use session state model that allows you to store arbitrary data and objects across multiple Web requests. It uses dictionary-based, in-memory objects to reference these object references in the IIS process) cache to complete this operation. When using the in-process session Status mode, consider the following restrictions:

When the in-process session Status mode is used, if the aspnet_wp.exe or application domain restarts, the session status data will be lost. These reboots usually occur in the following situations:

In the <processModel> element of the Web. config file of the application, set an attribute that causes the new process to start when the condition is met, such as memoryLimit.

Modify the Global. asax or Web. config file.

Change to the Bin directory of the Web application.

Scan and modify files in the Global. asax file, Web. config file, or Bin directory of the Web application using anti-virus software.

If the network garden mode is enabled in the <processModel> element of the Web. config file of the application, do not use the in-process session state mode. Otherwise, random data will be lost.

There are two solutions to ASP. NET Session Timeout:

1. Set the SESSION on the first page, and then REDIRECT the second page. The solution is to set endResponse to FALSE in REDIRECT.

Ii. ASP. NET uses the ACCESS database, which is stored in the bin directory. The solution is not to put the updated files in the BIN directory.

Reference: http://www.dotnet247.com/247reference/msgs/58/290316.aspx

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

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.