Clearing a session w/o Session.abandon ?

Results 1 to 3 of 3

Thread: Clearing a session w/o Session.abandon ?

  1. #1
    Join Date
    Dec 1969
    Posts
    1,671

    Default Clearing a session w/o Session.abandon ?

    Is there an easy way to clear out everything stored in session variables without actually abandoning the session ?<BR><BR>Thanks,<BR>Mike<BR><BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Clearing a session w/o Session.abandon ?

    WARNING: Untested Code. It is late, I am still at work, I am tired. So, I could go test this, but I&#039ve had Visual InterDev running for over 12 hours, and I really don&#039t feel like writing more code right now. I think I know how to do this, but just wanted to let you know that this may not be 100% syntactically correct:<BR><BR>&#039Iterate through all of the items in the session<BR>Dim sessionObject<BR>For Each sessionObject in Session.Contents<BR>Set sessionObject = Nothing<BR>Next<BR><BR>If that doesn&#039t work try:<BR>Dim iLoop<BR>For iLoop = 1 to Session.Contents.Count<BR>Set Session(iLoop) = Nothing<BR>next<BR><BR>Good luck!

  3. #3
    Bill Anthony Guest

    Default RE: Clearing a session w/o Session.abandon ?

    Scott:<BR><BR>I would like to expand on this concept and ask if you, or anyone else, knows of a way to clear a SINGLE session variable without affecting others already claimed and established. That is, if I claim a group of session variables like so:<BR> <BR> Session("item1")=Request.Form("item1")<BR> Session("item2")=Request.Form("item2")<BR> Session("item3")=Request.Form("item3")<BR><BR>Can I then clear Session("item2") without affecting the active status of Session("item1") and Session("item3")?<BR><BR>This may be an elementary question, but I have tried looking this up in many resources without much luck. Thanks for your time!<BR><BR>Bill Anthony

Posting Permissions

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