Summary of solutions for session loss

Source: Internet
Author: User

recently in doing ASP.net project, the test site is always not get the value of the session, search the Internet for a while, find some solutions, recorded here. Finally, the problem is solved by using the method stored in StateServer.

sessionstate timeout), the main reasons are three kinds.

One: Some kill virus software will go to scan your Web.config file, at that time session affirmation drops, this is Microsoft's saying.

Two: Inside the program has let session loses the code, and the server memory is insufficient to produce.

Third: The program has frames page and cross domain situation.

The first solution is to make the virus-killing software screen scan the web.config file (not to edit it when the program is running)
The second is to check whether the code has Session.Abandon () or not.
The third is to start the ASP.net State Service in the window service.

The following are the contents of the Help:

(Ms-help://ms. Vscc.2003/ms. msdnqtr.2003feb.2052/cpguide/html/cpconsessionstate.htm)
ASP.net provides a simple, easy-to-use session-state model that you can use to store arbitrary data and objects across multiple WEB requests. It completes the operation using a dictionary-based, in-memory object reference (these object references exist in the IIS process) cache. Consider the following limitations when using the in-process session state mode:

When using the in-process session state mode, session state data is lost if the Aspnet_wp.exe or application domain restarts. These reboots typically occur in the following situations:
In the <processModel> element of the application's Web.config file, set a property that causes the new process to start when the condition is met, such as memorylimit.
Modify Global.asax or Web.config files.
Change to the WEB application's \ Bin directory.
Use antivirus software to scan and modify files in the \ Bin directory of Global.asax files, web.config files, or Web applications.
If network garden mode is enabled in the <processModel> element of an application's Web.config file, do not use the in-process session-state mode. Otherwise, random data loss will occur.

And there are two of these:

One: The session is placed on the first page and then redirect to the second page. The workaround is to set Endresponse to False in redirect.

Two: ASP. NET, and the database is placed in the bin directory. The workaround is to not put the updated file in the bin directory.

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

Total 2 page: previous 1 [2] Next page



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.