Results 1 to 3 of 3

Thread: Session Variables???

  1. #1

    Thread Starter
    Addicted Member wernerh's Avatar
    Join Date
    Sep 2000
    Posts
    170

    Question Session Variables???

    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??

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    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.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Red face

    josh is right. if you want it to persist, create a cookie instead of the session variable.
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

Posting Permissions

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



Click Here to Expand Forum to Full Width