3 Attachment(s)
Session Variables Are Dropping Within 2 Minutes
Hello all,
I am currently working on an ASP.NET v4.0 project using VB Script for the server-side code. I have a number of session variables that I am using across multiple pages. My problem is that although I have set the session timeout to be 20 minutes or longer (programmatically, in Web.Config, and IIS), the Session variables are being dumped after exactly 2 minutes.
Web.config contents:
Code:
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" timeout="900"/>
</authentication>
Session_Start routine:
Code:
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Session.Timeout = 1200 ' Setting to a very high number to ensure that whatever timeout value is set in IIS *should* stick
Session("VariableNames") = VariableValues ' ... multiple values here
End Sub
After exactly 2 minutes (120 seconds) from the last refresh, all the values retrieved using Session("<insert variable name here>") are blank. Here are a few screen caps to show the IIS settings.
Attachment 90097Attachment 90099Attachment 90101
Additionally because of this problem, I have created a generic dummy handle page called KeepSessionAlive.ashx and the following javascript is called using setInterval(KeepSessionAlive, 10000); (every 10 seconds) and I have confirmed that it is working, but the Session variables are still being dumped.
Code:
function KeepSessionAlive() {
//alert('testing');
$.post("KeepSessionAlive.ashx", null, function () {
$("#result").append("<p>Session is alive</p>");
});
}
Am I missing something? Why is it dropping my Session values? Any help or information would be greatly appreciated.
Thanks,
John Bergman
Re: Session Variables Are Dropping Within 2 Minutes
set the 2 hr timeout value to 00:00:00
Re: Session Variables Are Dropping Within 2 Minutes
Quote:
Originally Posted by
Bill Crawley
set the 2 hr timeout value to 00:00:00
Personally, creating a never ending session is not something that I would recommend.
Gary