在asp.net会话处理 [英] session Handling in asp.net

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

问题描述

我试图找出如何当用户导航从我离开site.I摧毁一个ASP.NET会话正在使用Global.ascx应用程序文件,并使用Session_End中的事件。它的做工精细当我​​点击注销按钮。但是,当我直接关闭浏览器它不使用后20 minitues全局文件。我web.conig文件作为<的sessionState模式=是InProc超时=20>< /&的sessionState GT;

请帮我

奥古斯丁

I am trying to find out how to destroy a ASP.NET session when the user navigates away from my site.I am using Global.ascx application file and use session_end event .Its working fine when i click logout button. But when i close browser directly its not using Global file after 20 minitues. i used in web.conig file as <sessionState mode="InProc" timeout="20"></sessionState>
Please help me
Augustine

推荐答案

会话超时定义当一些会议将部分闲置时间后销毁。

Session timeout defines when some session would be destroyed after some idle time.

如果你想在会议更多的控制,你需要使用SQLServer模式,状态服务器模式,还是自定义的taylored自己。

If you want more control over sessions, you would need to use SQLServer mode, State Server mode, or a custom one taylored yourself.

我的意思是,因为,例如,SQLServer模式门店的会议在标准的SQL Server表,这样,就可以实现一些SQL Server作业,或在Windows或在某些Windows服务安排一些任务,所以您可以清理根据您的需要会话。

I mean that, because, for example, SQLServer mode stores sessions in a standard SQL Server table, so, you can implement some SQL Server job, or schedule some task in Windows or in some Windows Service, so you can clean up sessions depending on your needs.

顺便说一句,也许你需要知道,如果你使用的是InProc,你的会话可以被毁灭,因为IIS回收应用程序池,或服务器得到完全重新启动。这不是结束会话,因此此时,相应的事件处理程序不会在这种情况下工作。

By the way, maybe you need to know that if you're using InProc, your sessions can be destroyed because IIS recycled application pool, or server got entirely restarted. And this isn't ending sessions, so the appropiate event and handler won't work in this scenario.

我再说一遍,如果你需要一个更好的会话管理模式,像那些我建议你。

I repeat, if you need a better session management mode like ones I suggested you.

编辑:

查看此网页:
<一href=\"http://aspalliance.com/520_Detecting_ASPNET_Session_Timeouts.2\">http://aspalliance.com/520_Detecting_ASPNET_Session_Timeouts.2

您将学习如何处理会话超时更好,因为当一个会话过期Session_End中不叫,但是当你调用Session.Abandon。

You'll learn how to handle session timeouts better, since Session_End isn't called when a session expires, but when you call "Session.Abandon".

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

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