Session Expiration issue
Last Update:2017-01-13
Source: Internet
Author: User
sessionstate timeout), the main reasons are three kinds.
: 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 the session loses the code, and the server memory is not enough to produce.
Three: The program has frames page and cross domain situation.
The first solution is to make the virus-killing software screen scan Web.config file (the program does not edit it when it is running)
the second is to check whether the code has Session.Abandon () or something.
the third is to start the ASP.net State Service in the window service.
http://community.111cn.net/Expert/topic/3100/3100218.xml?temp=.4426386
may also be the file that you changed during the test, the website.
I tested no problem! The test procedure is as follows:
protected void Application_Start (Object sender, EventArgs e)
?? {
??? SqlConnection con = new SqlConnection ("server=localhost;database=yourdatabase;uid=sa;pwd=;");
??? SqlCommand cmd = new SqlCommand (string. Format ("INSERT INTO table1 (c) VALUES (' {0} ')", "Application_Start" +datetime.now.tolongtimestring () + "Application ID" + Application.tostring ()), con);
??? Con. Open ();
??? Cmd. ExecuteNonQuery ();
??? Con. Close ();
??}
?
?? protected void Session_Start (Object sender, EventArgs e)
?? {
??? SqlConnection con = new SqlConnection ("server=localhost;database=yourdatabase;uid=sa;pwd=;");
??? SqlCommand cmd = new SqlCommand (string. Format ("INSERT INTO table1 (c) VALUES (' {0} ')", "Session_Start" +datetime.now.tolongtimestring () + "sessionid=" + Session.SessionID), con);
??? Con. Open ();
??? Cmd. ExecuteNonQuery ();
??? Con. Close ();
??}
?? protected void Application_BeginRequest (Object sender, EventArgs e)
?? {
??? SqlConnection con = new SqlConnection ("server=localhost;database=yourdatabase;uid=sa;pwd=;");
??? SqlCommand cmd = new SqlCommand (string. Format ("INSERT INTO table1 (c) VALUES (' {0} ')", "Application_BeginRequest" +datetime.now.tolongtimestring ()), con);
??? Con. Open ();
??? Cmd. ExecuteNonQuery ();
??? Con. Close ();