Session State ?

  • Thread starter Thread starter WJ
  • Start date Start date
W

WJ

I am setting the Session State TimeOut to 54 minutes (20 is default) in the
Web.Config. I use SQL Server to persist the session states & ID. As long as
I am remaining in the web sites, I see all the data persisted from page to
page. However, once I quit the browser (MS/IE 6.1) and got backin within 2
seconds, the persisted data no long existed. My impression on the "timeout"
paramter is that as long as I come back to my site within the defined
timeout period (54 minutes), I should see my data from previous sessions
without re-entering them. At this point I am still running my web app. on my
XP/Sp1 Prof.. and SQL Developer edition. I inspected the ASPState DB and it
appears to capture the sessions properly. The time out is also recorded to
the database properly.

Thanks for your help,

John
 
WJ,
This issue requires an understanding about how ASP.NET session works.
First, ASP.NET will put a non-persistent cookie in the user's browser called
ASP.NET SessionID. Since that cookie is present with the Session ID on
every request, ASP.NET can match the browser with the correct session. When
you close the browser, and since it's a non-persistent cookie, the cookie is
automatically discarded, so you open another browser, and you don't have the
cookie. The session is still available on the server, but you don't have
the cookie to match you up with it, so ASP.NET issues you another
non-persistent cookie along with another session. To support multi-browser
sessions, you could add code to make the cookie persistent in your
Global.asax file on Session start.

Best regards,
Jeffrey Palermo
 
Hi John,

This sounds like the expected behaviour: A Session ends if the user fails
request your site's page for 54 minutes OR they close the browser. Don't
forget that the session cookie is stored in memory in the browser so it
disappears when the browser closes.

Ken
 
Back
Top