为什么当StateProvider不INPROC不会引发Session_End中的事件吗? [英] Why Session_End event not raised when StateProvider is not InProc?

查看:129
本文介绍了为什么当StateProvider不INPROC不会引发Session_End中的事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要问这个问题,出于好奇。

I'm asking this question out of curiosity.

我在Global.asax中注意到了这一点。

I noticed this in my global.asax

void Session_End(object sender, EventArgs e)
{
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.
}

我想知道为什么Session_End中的事件则不会捕捉/引发当会话模式的StateServer或SQLServer的?

I want to understand why Session_End event is not captured/raised when the session mode is StateServer or SQLServer ?

推荐答案

,因为 ASP.NET会话状态它不是在内存中了...

because the ASP.NET Session State it's not in memory anymore...

使用不同的过程来存储会话状态时,在 IIS不知道会话结束时(因为它没有耦合,会话状态不会被IIS举行了)..

when using a different process to store the Session State, the IIS does not know (because it is not coupled, the session state is not held by the IIS anymore) when the session ends...

这是专门因为超时,我从来没有尝试过,但确实是事件触发,当你调用programaticaly Session.Abandon()??

this is specially because the timeouts, I never tried, but does that event fires when you programaticaly call Session.Abandon() ??

这篇关于为什么当StateProvider不INPROC不会引发Session_End中的事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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