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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

session variables

Status
Not open for further replies.

link9

Programmer
Nov 28, 2000
3,387
US
Can anyone clarify for me how to "refresh" a session variable?

If I just check it, does that refresh it, or do I need to reassign it to refresh it, or what?

thx
Paul Prewett
 
Hi Link9,

I'm trying to understand your questions...i don't know what you mean by "refresh", but when you want to update the variable stored in the Session. You have to reassign them. for example. you have this:

Session("Test") = test

everything you write out Session("Test") it would print out test for the duration of the Session.

If you want to changed Session("Test")
then you have to do:

Session("Test") = test1

That is the only way to modify the Session variable.

I hope that helps.

Hui
 
Sorry -- let me clarify --

A session variable has a default lifespan of 20 minutes --

However, if a user is in my site for longer than that, and has permission to be there (I check their password on every page), then I want them to be able to stay -- without having to log back in

I don't want to extend the life of the variable, though, because if they leave without logging out, then I don't want that variable hanging around any longer than that.

What I guess the question is is how to refresh the lifespan of a session variable to reset that 20 minute clock that starts running when I create it.

thx
paul
 
Hi Link9

I assume that whenever you set a new variable to the Session then it reset it's lifespan. For example

Session("Test") = test (20 minute lifespan)

when you reassign it, i think i should reset the lifespan back to 20 minutes)

But becareful not to call Session.Expire, this destroy the Session object along with ALL Session Variables.

Hui
 
I may be wrong, but it's my understanding that the 20 minutes (or whatever it's set at) starts counting at the last visit to the server. So if you refresh your page or go to another page in the same web application, the 20 minutes starts over again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top