【发布时间】:2017-03-21 23:19:36
【问题描述】:
是否有机会检测到会话超时后是否已调用 Session_End 方法在 web.config 中设置的超时时间或 IIS 本身是否在终止会话后调用设置的应用程序池超时?
【问题讨论】:
是否有机会检测到会话超时后是否已调用 Session_End 方法在 web.config 中设置的超时时间或 IIS 本身是否在终止会话后调用设置的应用程序池超时?
【问题讨论】:
您可以使用 Global.asax 的 Session_End 事件。
Session_End 事件在会话到期或应用程序池按计划回收时自动引发。
private 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.
}
【讨论】: