会话管理问题 [英] problem about session management
问题描述
在我的项目中,我使用了会话,当我注销时,我编写了session.abandone().
是好的还是我应该将所有会话变量都为空.
请帮帮我.
谢谢.
In my project I have used session and when I logout i have written session.abandone().
is it good or I should null all my session variable.
please help me.
Thanks.
推荐答案
Itz好方法.因为当用户关闭浏览器时会话不会结束.关闭浏览器后,与服务器之间没有通信,因此服务器无法知道结束会话.
Itz good approach. Because session does not end when a user closes his browser. There is no communication with the server when a browser is closed so there is no way the server can know to end the session.
我认为您使用了最好的方法.而是可以使用
I think you used the best method. instead of that you can use
Session.Clear()
Session.RemoveAll()
这些清除了会话,但将会话实时保留在内存中.
如果使用inproc模式存储会话(而不是sql服务器或状态服务器),则globle.asax文件session_end()事件将在调用
those are clear the session but keep session in memory in live.
if you are using inproc mode to store the session (not the sql server or state server ) globle.asax file session_end() event will fire when ever called
session.abandone().
或会话超时时触发.如果您想在一段时间后自动终止会话,可以使用
or time out of the session . if you want to expire session automatically after some time you can use
<system.web><sessionState mode="InProc" timeout="20"></sessionState>
</system.web>
薄荷糖在哪里超时.
where time out in mints.
这篇关于会话管理问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!