在会话过期之前是否有任何事件 [英] Is there any event for before session Expire

查看:96
本文介绍了在会话过期之前是否有任何事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hashtable sessions =(Hashtable)System.Web.HttpContext.Current.Application [WEO];





Hashtable sessions = (Hashtable)System.Web.HttpContext.Current.Application["WEO"];


if (System.Web.HttpContext.Current.Application["Login"] != null )
                {
                    sessions.Remove(System.Web.HttpContext.Current.Application["Login"].ToString());
                }







我需要在会话到期前执行以上行...



会话到期前是否有任何活动?



我如何调用上述代码...在我的申请中会话到期的情况....





谢谢,

亲爱的




I need to execute the above lines before session expiration...

Is there any event before session expired??

How can i call the above code.. in the case of session expiration in my application....


Thanks,
honey

推荐答案

请参阅此CodeProject文章: ASP.NET中的警报会话超时 [ ^ ]。



-SA
Please see this CodeProject article: Alert Session Time out in ASP.NET[^].

—SA


看看这里:会话状态事件 [ ^ ]

Have a look here: Session-State Events[^]
MSDN写道:

你可以处理 Session_OnEnd 事件通过向 Global.asax 文件添加名为 Session_OnEnd 的子例程。当调用 Abandon 方法或会话已过期时,将运行 Session_OnEnd 子例程。当Timeout属性指定的分钟数没有为会话发出请求时,会话到期。

You can handle the Session_OnEnd event by adding a subroutine named Session_OnEnd to the Global.asax file. The Session_OnEnd subroutine is run when the Abandon method has been called or when the session has expired. A session expires when the number of minutes specified by the Timeout property passes without a request being made for the session.





示例代码:规则用户会话到期(AspNetAlertSessionExpire) [ ^ ]


这篇关于在会话过期之前是否有任何事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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