会话过期中的可变生存期 [英] variable lifetime in session expiration

查看:83
本文介绍了会话过期中的可变生存期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们.
我有一个关于会话过期的问题.
会话到期时,用于变量的内存是否会清除?
换句话说,我们可以在会话期满后使用全局变量吗?
<高级,谢谢.

Hi friends.
I have a question about session expiration.
does the memory that is for a variable get clear when session expires?
in the other words can we use our global variables after session expiration?
thanks in advanced.

推荐答案

不使用变量且垃圾收集器已准备好清除它时,该变量将被清除.
这与会话变量无关.

会话状态只不过是字典或哈希表形式的内存,例如键值对,可以在用户会话期间进行设置和读取.该词典链接到会话.
一旦超时到期,ASP.NET将终止一个不活动的会话并处置该会话的状态.
因此字典被破坏了.

因此,从您的问题的角度来看,声明的变量和会话是独立的事物,一个被处置并不意味着另一个已被处置.

这些是很棒的链接-
http://msdn.microsoft.com/en-us/magazine/cc163730.aspx [ ^ ].
http://msdn.microsoft.com/en-us/library/ff647327.aspx# diforwc-ch05_cachingstate [^ ]
A variable is cleared when you are not using it and the garbage collector is ready to clean it up.
This has nothing to do with session variables.

Session state is nothing more than memory in the shape of a dictionary or hash table, e.g. key-value pairs, which can be set and read for the duration of a user''s session. This dictionary is linked to the session.
Once the timeout expires, ASP.NET terminates an inactive Session and disposes of the state for that session.
Thus the dictionary is destroyed.

Thus from your question''s point of view, the variable and session stated are independent things and one being disposed does not mean the other has been disposed.

These are some great links -
http://msdn.microsoft.com/en-us/magazine/cc163730.aspx[^].
http://msdn.microsoft.com/en-us/library/ff647327.aspx#diforwc-ch05_cachingstate[^]


这篇关于会话过期中的可变生存期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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