加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 为什么当StateProvider不是InProc时,不会引发Session

发布时间:2020-12-16 00:12:36 所属栏目:asp.Net 来源:网络整理
导读:出于好奇,我问这个问题. 我在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
出于好奇,我问这个问题.

我在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.
}

我想了解为什么会话模式是StateServer或SQLServer时没有捕获/引发Session_End事件?

解决方法

因为 ASP.NET Session State它不再存在于内存中……

当使用不同的进程来存储会话状态时,IIS不知道(因为它没有耦合,会话状态不再由IIS保存)会话结束时……

这是特别因为超时,我从未尝试过,但当你编程调用Session.Abandon()时,那个事件是否会触发?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读