asp.net - 使用 HttpModules 将事件附加到 Session OnStart 和 OnEnd

标签 asp.net session events httpmodule

有谁知道使用 HttpModule 将事件添加到 Session 的 OnStart 和 OnEnd 事件的干净方法(不涉及 Global.asax 文件)?

最佳答案

public void Init(HttpApplication app)
{
   var ssm = app.Modules["Session"] as SessionStateModule;
   ssm.Start += Foo;
   ssm.End += Bar;
}

关于asp.net - 使用 HttpModules 将事件附加到 Session OnStart 和 OnEnd,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/539171/

相关文章:

c# - 如何在 ASP.net 中显示加载页面指示器?

jquery - 页面刷新后 SignalR 不向客户端广播数据

asp.net - Asp.net 4.0 中的安全和不安全页面

c# - 延长 asp.net session 结束日期?

c# - 在回调请求上保留 ViewState

c++ - 有没有办法在qt中卸载eventfilter?

javascript - jQuery 使用 for 循环触发事件 n 次

asp.net - 如果安全页面执行回发,回发会继续在安全页面上吗?

Hibernate Session关闭问题!

wpf - WPF自定义路由事件-如何退订?