删除HttpContext.Current.Session [英] Remove HttpContext.Current.Session

查看:1840
本文介绍了删除HttpContext.Current.Session的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储会话变量的应用程序。当我做了我注销调用removeall过()方法上提供会话。

这个方法似乎不工作。你知道它是如何可以强制删除一个Session变量?

问候。


解决方案

  Session.Abandon()

取消当前会话

  Session.Clear()

只是清除会话数据和会话将保持活动

更多细节:

Session.Abandon()方法销毁存储在Session对象中的所有对象,并释放其资源。如果你不叫放弃明确的方法,服务器销毁这些对象时,会话超时(我可能会增加:<​​code>的Session_OnEnd 事件触发时)

http://msdn.microsoft.com/en-us/library/ ms524310.aspx

Session.Clear()刚刚从对象中删除所有值(内容)。使用相同的密钥会议还活着。

I have an application which stores session variables. When I do the logout I call the RemoveAll() method on available sessions.

The method seems not working. Do you know how it is possible to force removing a Session variable?

Regards.

解决方案

Session.Abandon()

cancels the current session

Session.Clear() 

will just clear the session data and the the session will remain alive

more Details:

Session.Abandon() method destroys all the objects stored in a Session object and releases their resources. If you do not call the Abandon method explicitly, the server destroys these objects when the session times out(I may add:Session_OnEnd event is triggered)

http://msdn.microsoft.com/en-us/library/ms524310.aspx

Session.Clear() just removes all values (content) from the Object. The session with the same key is still alive.

这篇关于删除HttpContext.Current.Session的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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