Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I test a Session has Timed out????

Status
Not open for further replies.

pwel

Programmer
Aug 18, 1999
79
GB
Hi all,

I need to be able to test if a Session has timeout out, to prevent an error ocurring.

Cheers in advance,

Paul. Paul Welding
Web Developer
 
If session("mysession") = ""
'session is no longer there..
Else
'session is still there..
End if jason@vzio.com
s_vzio.gif
 
What snowboardr said will work as long as you set the variable "mysession" to some flag in the session start event within global.asax

You might want to try Session.IsNewSession - this is supposed to tell you if the session was initiated with the current request

HTH

Mark
 
Ooops! I thought this was the asp.net forum!

Snowboardr's reply and my comment on it are still valid, but session.isnewsession does not exist in classic asp

Sorry

Mark
 
Cheers guys,

I set a variable in the global.asa and tested for it having a vaild value in my pages, works a treat.

Cheers again.

Paul. Paul Welding
Web Developer
 
Curious, why do you have to edit the global asa to achieve what you are wanting to do?
star.gif
if I helped. [wink]
s_vzio.gif
 
snowboardr,

I set a session variable, Session("userLoggedIn") = "no" in the global.asa so it was set when the session starts.

Once the user has been authenticated, I set the variable to = "yes" from my pages. I then test for it at the start of each page, if the session had ended the variable would not exist, and i redirect the user back to the login page..

Hope that makes sense.

Paul. Paul Welding
Web Developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top