Results 1 to 2 of 2

Thread: Losing Session Variables before the Session is supposed to expire

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2012
    Posts
    5

    Losing Session Variables before the Session is supposed to expire

    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.

    Name:  1.png
Views: 1491
Size:  28.7 KBName:  2.png
Views: 1587
Size:  21.9 KBName:  3.png
Views: 1459
Size:  21.1 KB

    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

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2012
    Posts
    5

    Re: Losing Session Variables before the Session is supposed to expire

    I am very sorry.

    I have mistakingly posted this in the ASP Classic Forum, and it belongs in the ASP.NET Forum.

    Can a moderator move this post for me? Or should I repost this? Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width