using System; using System.Web; using CMS.CMSHelper; using CMS.SettingsProvider; public class CMSHttpApplication : HttpApplication { #region "Variables" /// /// True if handlers were already initialized /// private static bool mHandlersInitialized = false; /// /// Lock object /// private static object mLock = new object(); #endregion #region "Application events" /// /// Application start event handler. /// public void Application_Start(object sender, EventArgs e) { // Azure Application start init AzureInit.Current.ApplicationStartInit(); CMSAppBase.CMSApplicationStart(); } /// /// Application error event handler. /// public void Application_Error(object sender, EventArgs e) { CMSAppBase.CMSApplicationError(sender, e); } /// /// Application end event handler. /// public void Application_End(object sender, EventArgs e) { CMSAppBase.CMSApplicationEnd(sender, e); } #endregion #region "Session events" /// /// Session start event handler. /// public void Session_Start(object sender, EventArgs e) { CMSAppBase.CMSSessionStart(sender, e); } /// /// Session end event handler. /// public void Session_End(object sender, EventArgs e) { CMSAppBase.CMSSessionEnd(sender, e); } #endregion #region "Request events" /// /// Constructor /// public CMSHttpApplication() { InitHandlers(); } /// /// Initializes the handlers /// private void InitHandlers() { if (mHandlersInitialized) { return; } lock (mLock) { if (mHandlersInitialized) { return; } // Map the request handlers CMSApplicationModule.BeginRequest += CMSAppBase.CMSBeginRequest; CMSApplicationModule.AuthenticateRequest += CMSAppBase.CMSAuthenticateRequest; CMSApplicationModule.AuthorizeRequest += CMSAppBase.CMSAuthorizeRequest; CMSApplicationModule.MapRequestHandler += CMSAppBase.CMSMapRequestHandler; CMSApplicationModule.PostMapRequestHandler += CMSAppBase.CMSPostMapRequestHandler; CMSApplicationModule.AcquireRequestState += CMSAppBase.CMSAcquireRequestState; CMSApplicationModule.EndRequest += CMSAppBase.CMSEndRequest; CMSApplicationModule.PreSendRequestHeaders += CMSAppBase.CMSPreSendRequestHeaders; mHandlersInitialized = true; } } #endregion #region "Overridden methods" /// /// Custom cache parameters processing. /// public override string GetVaryByCustomString(HttpContext context, string custom) { return CMSAppBase.CMSGetVaryByCustomString(context, custom); } #endregion }