void context_PreRequestHandlerExecute(object sender, EventArgs e) { if (HttpContext.Current.Handler is Page) { Page page = (Page)HttpContext.Current.Handler; page.Unload += new EventHandler(page_Unload); if (HttpContext.Current.Session != null) { if (LOG.IsDebugEnabled) { LOG.Debug("context_PreRequestHandlerExecute: Processing HttpContext.Current.Session"); } foreach (String convMngName in this.ConversationManagerNameList) { if (LOG.IsDebugEnabled) { LOG.Debug(string.Format("context_PreRequestHandlerExecute: Processing ConversationManager: {0}", convMngName)); } IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName); convMng.EndOnTimeOut(); convMng.FreeEnded(); } } else { if (LOG.IsDebugEnabled) { LOG.Debug("context_PreRequestHandlerExecute: no HttpContext.Current.Session found."); } } } }
/// <summary> /// Handles the Unload event of the page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> /// <remarks> /// Necessary for Redirect or Abort for any reason. /// </remarks> void page_Unload(object sender, EventArgs e) { if (LOG.IsDebugEnabled) { LOG.Debug("page_Unload HttpContext.Current.Session is null: " + (HttpContext.Current.Session == null)); } foreach (String convMngName in this.ConversationManagerNameList) { if (LOG.IsDebugEnabled) { LOG.Debug(string.Format("page_Unload: Processing ConversationManager: {0}", convMngName)); } IConversationManager convMng = (IConversationManager)this.applicationContext.GetObject(convMngName); convMng.EndOnTimeOut(); convMng.FreeEnded(); convMng.PauseConversations(); } }