PDA

Click to See Complete Forum and Search --> : Session Variables???


wernerh
Jun 15th, 2001, 02:55 AM
I use a Session variable called Session("UserName") to store a users username. When I set this variable and the close the browser window, the session is only supposed to end when when the session times out, Right? (20 minutes)

Why then when I open the browser again, before 20 min, is that session varaible lost? I have checked and the sessionID stays the same if I open and close the browser. Nowhere in my pages do I clear the variable, and nowhere do I call the session.abandon method???

Any explanations??

JoshT
Jun 15th, 2001, 06:13 AM
When I set this variable and the close the browser window, the session is only supposed to end when when the session times out, Right? (20 minutes)

Yes, that is right.

Why then when I open the browser again, before 20 min, is that session varaible lost?

Because the Session ID is actually a temporary Cookie sent to the Browser. When you close the browser, the Cookie is deleted from memory.

abhijit
Jun 15th, 2001, 06:17 AM
josh is right. if you want it to persist, create a cookie instead of the session variable.