如何处理在Global.asax中会话结束? [英] How to handle session end in global.asax?

查看:265
本文介绍了如何处理在Global.asax中会话结束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在聊天应用程序的工作,我用哈希表包含用户和运营商的密钥和放大器;聊天室类对象作为哈希表的值。主要问题是,当用户或操作员关闭浏览器或者断开连接,而不注销然后,它会自动在会议结束时注销。

I'm working in chat application, I used HashTable for containing User and Operator as a Key & Object of ChatRoom Class as a value of HashTable. Main problem is that When user or Operator close browser or disconnected without logout then It is automatically logout on the end of the session.

请帮我有关的,以及如何在这个问题上使用Global.asax中。

Please help me related to that and how to use Global.asax in this matter.

推荐答案

您可以使用Global.asax中的会话结束事件,除去意外断开的用户:

You can use global.asax's session end event to remove the unexpectedly disconnected user :

void Session_End(Object sender, EventArgs E) {
    // Clean up session resources
}

但要注意,当用户关闭浏览器或他的连接丢失会话不会结束。它结束时,会话超时达到。

but beware, session doesn't end when the user closes his browser or his connection lost. It ends when the session timeout reached.

这篇关于如何处理在Global.asax中会话结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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