Once you call Session.Abandon(), neither you, ASP.Net, nor the client
will
ever be able to access those values whether or not you call Clear() or
RemoveAll().
This is not technically accurate. It is possible to access session objects
even after session abandon is called. Page execution would have to totally
cease before your statement would be technically correct. The reason why I
suggested clear or removeall is because in most circumstances it would work.
Consider this: most security code cleanup is usually placed in the session
end event with a strong dependence on the uniqueness of the session id. In
this scenario, calling session abandon will lead to an application which is
not well behaved since session end isn't guaranteed to be called even in
InProc mode.
The literature on this is equally confusing as well but it's rather trivial
to write code to demonstrate this. It doesn't help also that the MSDN help
on session abandon is not accurate as well. There's a lot going on, enough
to be very cautious about giving a clear cut answer. In a nutshell, it
really depends on how your code is structured and what you want to
accomplish. If you want to clear the dictionary, any method will do equally
well. If what you are after is tracking sessions/logins/id's you have to be
very careful with which method you select.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
DalePres said:
I think Session.Abandon() is the best choice. The other two - Clear() and
RemoveAll() delete all session values but to not terminate the session.
Once you call Session.Abandon(), neither you, ASP.Net, nor the client will
ever be able to access those values whether or not you call Clear() or
RemoveAll().
The only one needed is Session.Abandon().
Dale
Alvin Bruney said:
Session clear or removeall is your best bet
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
Rob Meade said:
Hi all,
Having created a secure login, and then create session variables to detect
wether or not a user is logged in - I would now like to be able to off
a
log
out page!
I have found the following three in the intelli-help stuff :
Session.Abandon()
Session.Clear()
Session.RemoveAll()
In vanilla ASP I'd have used Session.Abandon - and probably on its
own -
is
this still ok/good enough - should I use the lot?
Any info would be appreciated please.
Regards
Rob