如何在机器意外关闭时实现Session.Abandon()? [英] How to implement Session.Abandon() on machine shutdown unexpectedly ?

查看:58
本文介绍了如何在机器意外关闭时实现Session.Abandon()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在vb.net.code中发布我的Web应用程序时,我想让我的Session.Abandon()在服务器上意外停机或上网禁用

请指示其紧急

i want to make my Session.Abandon() on unexpectedly machine shutdown or internet disable on server when i publish my web application in vb.net.code
please guid its urgent

推荐答案

使用Application_End事件的Global.asax文件



Use Global.asax file of Application_End event

Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown 
HttpContext.Current.Session.Abandon()
End Sub





获取更多信息

http://www.shotdev.com/aspnet/aspnet-vbnet-object/aspnet-vbnet-global-asax/aspnet-vbnet-global-asax-application-end/



在Global.asax的Application_End事件中访问会话变量


这篇关于如何在机器意外关闭时实现Session.Abandon()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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