How to save session variables of ASP. NET pages in an ASP. NET environment for a long time

Source: Internet
Author: User
How to save session variables of ASP. NET pages in an ASP. NET environment for a long time
IIS6 added to Windows2003 ServerProgramPool to recycle useless processes. When the application pool is automatically reclaimed due to website program errors or too many visits, the process will be automatically recycled to prevent the website from entering the "dead" status, at this time, the collection of the application pool will cause the session variable to be cleared, and the session variable will disappear.

To solve this problem in Windows2003, we started the ASP. Net state service on the server and made some changes in the system's machine. config. By default, the session state mode is StateServer. If the root directory of your website also has a web. config configuration file, change mode = "inproc" to mode = "StateServer", as shown below:CodeTo prevent the loss of session variables:

<Sessionstate

Mode = "StateServer"

Stateconnectionstring = "TCPIP = 127.0.0.1: 42424"

Sqlconnectionstring = "Data Source = 127.0.0.1; Integrated Security = sspi"

Cookieless = "false"

Timeout = "30"

/>

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.