Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2004
    Posts
    96

    Unanswered: ASP session removed after seconds, can't find reason

    Hello,
    i have a site using sessions to login. The server is set up to remove sessions after 30 minutes but it seems sessions are often deleted after a few seconds or minutes and I can't figure out why.
    I am using a global.asa file on this site, I am not too familiar with this and I am wondering if this could cause an error:
    Code:
    <SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
    
    
    function Session_OnStart()
    {
    
    Session.Timeout=60
    }
    
    
    var adoConnection = Server.CreateObject("ADODB.Connection");
    adoConnection.Open("dsn=xxx;uid=xxx;pwd=xxxxx;");
    function Session_OnEnd()
    {
    
    
    var removeL = "DELETE FROM tbllogged WHERE sesId = '"+String(Session.SessionID)+"'";
    adoConnection.Execute(removeL)
    
    
    
    }
    
    function Application_OnStart()
    {
    //clear the logged table when the server restarts
    var clearL = "DELETE FROM tbllogged";
    adoConnection.Execute(clearL);
    
    }
    
    
    
    </script>
    Or else what should I look out for, I just can't figure out why those sessions would be removed?

    many thanks
    Last edited by oliflorence; 03-27-07 at 11:20.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Is the session timeout in seconds or in minutes?
    I advise you look that up and post the answer in this thread
    George
    Home | Blog

  3. #3
    Join Date
    Aug 2004
    Posts
    96
    Hi there,
    isn't this always in minutes?

    Ref; http://www.w3schools.com/asp/prop_timeout.asp

    It is the Script.TimeOut that is in seconds.

    Kind regards,

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    It depends on the IIS/host settings. If you remove your timeout line, how does the application fair? default timeout is 20minutes.

    Your {}'s in the OnStart are a bit funny too..
    George
    Home | Blog

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Not function - SUB!
    I think
    :. no parens too
    George
    Home | Blog

  6. #6
    Join Date
    Aug 2004
    Posts
    96
    Hello,
    by removing the global.asa file the problem is defninitly gone so I am quiet sure the problem is coming from this.
    I have removed the
    function Session_OnStart()
    {

    Session.Timeout=60
    }
    all together since the default is 20 minutes any way but the problem is now back, any idea what could be changed on this:
    PS: the {} are there because it is in ASP JS.

    Code:
    <SCRIPT LANGUAGE="JavaScript" RUNAT="Server">
    
    
    
    
    
    var adoConnection = Server.CreateObject("ADODB.Connection");
    adoConnection.Open("dsn=xxxx;uid=xxxx;pwd=xxxxx;");
    function Session_OnEnd()
    {
    
    
    var removeL = "DELETE FROM tbllogged WHERE sesId = '"+String(Session.SessionID)+"'";
    adoConnection.Execute(removeL)
    
    
    
    }
    
    function Application_OnStart()
    {
    //clear the logged table when the server restarts
    var clearL = "DELETE FROM tbllogged";
    adoConnection.Execute(clearL);
    
    }
    
    
    
    </script>

Posting Permissions

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