注销后如何清除会话 [英] how to clear a session after logout

查看:87
本文介绍了注销后如何清除会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用defualt asp.net登录向导在注销后清除会话?

how to clear a session after logout using a defualt asp.net login wizard?

推荐答案

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().


这篇关于注销后如何清除会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆