If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP session removed after seconds, can't find reason

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-22-07, 05:15
oliflorence oliflorence is offline
Registered User
 
Join Date: Aug 2004
Posts: 96
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 10:20.
Reply With Quote
  #2 (permalink)  
Old 03-22-07, 06:54
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Is the session timeout in seconds or in minutes?
I advise you look that up and post the answer in this thread
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 03-22-07, 08:18
oliflorence oliflorence is offline
Registered User
 
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,
Reply With Quote
  #4 (permalink)  
Old 03-22-07, 08:21
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
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
Twitter | Blog
Reply With Quote
  #5 (permalink)  
Old 03-22-07, 08:22
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
Not function - SUB!
I think
:. no parens too
__________________
George
Twitter | Blog
Reply With Quote
  #6 (permalink)  
Old 03-27-07, 10:19
oliflorence oliflorence is offline
Registered User
 
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>
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On