Session in asp.net/c#
I would like to know the difference between
Session.clear();
Session.Abandon();
Session.Re开发者_StackOverflow社区moveAll();
Please explain the difference I'm struggling with my session sign out.
Thank you in anticipation
Session.Clear() removes all the content from the Object (values). The session with the same key is still alive.
Session.Abandon() destroys the session and the Session_OnEnd event is triggered. If you use this you will lose session and get a new session key. Consider using this with a "log out"
Session.RemoveAll() like Clear() this method deletes all items that have been added to the Session object's Contents collection.
Clear() and RemoveAll() perform the same thing: remove the session variables but keep the current session in memory. Whereas, Abandon() ends the current session.
精彩评论