开发者

Session in asp.net/c#

开发者 https://www.devze.com 2023-02-17 01:11 出处:网络
I would like to know the difference between Session.clear(); Session.Abandon(); Session.Re开发者_StackOverflow社区moveAll();

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消