Session expiration problem

zhaozj2021-02-12  132

SessionState's Timeout, there are three main reasons. One: Some kill virus software will scan your web.config file, then Session is sure, this is Microsoft's statement. 2: There is a code that is lost in the program, and the server is not generated. Three: The program has a frame page and cross-domain. The first solution is to scan the Web.config file in the murder of the killivirus software (the program is running yourself.) The second is that the check code has session.abandon (). The third is to start the ASP.NET STATE Service in the Window service.

Http://community.9cbs.net/expert/topic/3100/3100218.xml?temp=.4426386 It is also possible that you have changed during the test, the website of the website.

I have tested there is no problem! Test procedures are 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.tault Application.tostring ()) Application.toString ()), Con ); ??? cmd.executenon query (); ??? con.close ();

??} ??? protected_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 ); ??? cmd.executenon query (); ??? 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 (); ??}

?? protected void Application_EndRequest (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_endrequest" DateTime.now.tolongTimeString ()), Con); ??? con?open (); ?? CMD.executenonQuery (); ??? con.close ();

??}

?? protected void application_authenticaterequest (Object sender, Eventargs E) ?? {

??}

?? protected void Application_ERROR (Object Sender, Eventargs E) ?? {

??}

?? protected void session_end (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_end" DateTime.now.tolongTimeString () "sessionid =" session.SessionID), con);?? CON.Open (); ??? cmd.executenonury (); ??? con.close ();

??}

?? protected void Application_End (Object sender, EventArgs e) ?? {??? SqlConnection con = new SqlConnection ( "server = localhost; database = YourDatabase; uid = sa; pwd =;"); ??? SqlCommand cmd = new Sqlcommand ("" INSERT INTO TABLE1 (C) VALUES ('{0}') "," Application_end " DateTime.now.tolongTimeString ()), con); ??? con?open (); ?? CMD.executenonQuery (); ??? con.close (); ??}

All code is Global

转载请注明原文地址:https://www.9cbs.com/read-6296.html

New Post(0)