Click to See Complete Forum and Search --> : ASP Session Control
bulgarian388
11-04-2006, 01:58 PM
Hi all, I have a site that has a administrative end to which users need to log in to. Now I gave my users the ability to log out as well, or so i thought. I can't seem to be able to destroy the session when the person clicks on the "Log Out" button. I have tried all of these:
session("sessionName") = "" / null
session.Abandon()
session.Contents.RemoveAll()
None seem to work. Can anyone guide me in the right direction on how to destroy the session?
Thanks in advance
so_is_this
11-04-2006, 03:36 PM
None seem to work.
How did you determine this? I'm sure you understand that the Session object is not destroyed at the very moment you execute the Abandon method. It is not destroyed until that page ends or until after a Response.End statement is encountered. After executing the following, and in this sequence, the only way I would believe that the Session object had not actually been destroyed is if the next ASP page that executes still has access to the same Session variables that existed in the previous page.
Session.Contents.RemoveAll
Session.Abandon
bulgarian388
11-04-2006, 03:47 PM
Reason why I know that the session is still active is because the page that it redirects to still has the "Logged In" navigation, not the "Public" navigation. Plus I response.Write() all of my session variables one of which being called isLoggedIn, which is a boolean, and it remains "true" after the "Log Out". I tired this in my Log Out section:
session.Contents.RemoveAll()
session.Abandon()
response.End()
And it still doesn't work. Anyother suggestions on how to kill the session?
so_is_this
11-04-2006, 07:39 PM
Well, that is strange indeed. I guess your only choice is to reset each individual Session variable yourself.