更新时间:2023-11-09 08:40:28
Session.Clear();
除上述解决方案外,你应该使用
In addition to the above solution, you should use
Session.Abandon()
登出页面的Page_Load事件。点击此处 http://msdn.microsoft.com/en-us/ library / ms524310(v = vs.90).aspx [ ^ ]
这三种方法用于清除服务器的会话变量。
*** Session.Abandon包含Session.RemoveAll并删除为会话创建的会话ID。因此,对.aspx页面的后续请求将创建具有新会话ID的新会话。
*** Session.RemoveAll将删除所有用户定义的会话变量,但仍保持会话活动。如果你想结束会话,你必须使用Session.Abandon ()。
*** Session.Clear()与Session.RemoveAll()做同样的工作。
These three methods are used to clear session variables from the server.
***Session.Abandon includes Session.RemoveAll and also deletes the session id created for the session. So, subsequent request to .aspx page would create a new session with a new session id.
***Session.RemoveAll will remove all the user defined session variables but still keeps the session active.so if u want to end session you must use Session.Abandon().
***Session.Clear() do the same job as Session.RemoveAll().