private static void PageLoadHandler(object sender, EventArgs e) { HttpContext.Current.LoadConfigPageContent(true); if (((Page)sender).IsPostBack) { AutoEncryptControlValueHelper.DecryptControlsValue( ConfigSectionFactory.GetPageExtensionSection().AutoEncryptControlIDs.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries), (Page)sender); } }
/// <summary> /// 向页面添加配置扩展信息 /// </summary> /// <param name="context">HttpContext</param> /// <param name="checkAutoLoad"></param> public static void LoadConfigPageContent(this HttpContext context, bool checkAutoLoad) { if (context != null) { PageContentSection section = ConfigSectionFactory.GetPageExtensionSection(); Page page = context.GetCurrentPage(); if (page != null) { if (checkAutoLoad) { if (section.AutoLoad == false) { return; } if (page.Header == null) { return; } string headerAutoLoad = page.Header.Attributes["autoLoad"]; if (headerAutoLoad.IsNotEmpty() && headerAutoLoad.ToLower() == "false") { return; } } if (WebAppSettings.IsWebApplicationCompilationDebug()) { RegisterCssInHeader(page, section.CssClasses.Debug); } else { RegisterCssInHeader(page, section.CssClasses.Release); } RegisterCssInHeader(page, section.CssClasses.All); if (WebAppSettings.IsWebApplicationCompilationDebug()) { RegisterScriptInHeader(page, section.Scripts.Debug); } else { RegisterScriptInHeader(page, section.Scripts.Release); } RegisterScriptInHeader(page, section.Scripts.All); } } }
private void page_PreRenderComplete(object sender, EventArgs e) { RegisterDefaultNameTable(); AutoEncryptControlValueHelper.EncryptControlsValue( ConfigSectionFactory.GetPageExtensionSection().AutoEncryptControlIDs.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries), (Page)sender); PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("PageContentModule-RecursiveTranslate", () => TranslatorControlHelper.RecursiveTranslate((Page)sender)); DeluxeNameTableContextCache.Instance.RegisterNameTable((Page)sender); ((Page)sender).ClientScript.RegisterClientScriptBlock(this.GetType(), "DeluxeApplicationPath", string.Format("var _DeluxeApplicationPath = \"{0}\";", HttpContext.Current.Request.ApplicationPath), true); }