/// <summary> /// 将PageModule和page关联 /// </summary> /// <param name="page"></param> public static void AttachPageModules(Page page) { foreach (IPageModule module in ConfigSectionFactory.GetPageModulesSection().Create().Values) { module.Init(page); } }
/// <summary> /// 根据ContentTypeKey,得到Response的ContentType /// </summary> /// <param name="key">ContentTypeKey</param> /// <returns>ContentType</returns> /// <remarks>根据ContentTypeKey,得到Response的ContentType</remarks> public static string GetContentTypeByKey(string key) { ContentTypesSection section = ConfigSectionFactory.GetContentTypesSection(); key = key.ToLower(); ContentTypeConfigElement elt = section.ContentTypes[key]; string contentType = elt != null ? elt.ContentType : string.Empty; return(contentType); }
private static void PageLoadHandler(object sender, EventArgs e) { WebUtility.LoadConfigPageContent(true); if (((Page)sender).IsPostBack) { AutoEncryptControlValueHelper.DecryptControlsValue( ConfigSectionFactory.GetPageExtensionSection().AutoEncryptControlIDs.Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries), (Page)sender); } }
private void PreRequestHandlerExecuteHandler(object sender, EventArgs e) { Page page = HttpContext.Current.CurrentHandler as Page; if (page != null) { _PageModules = ConfigSectionFactory.GetPageModulesSection().Create(); foreach (IPageModule module in _PageModules.Values) { module.Init(page); } } }
/// <summary> /// 根据文件扩展名,得到Response的ContentType /// </summary> /// <param name="fileExtesionName">文件扩展名</param> /// <returns>ContentType</returns> /// <remarks>根据文件扩展名,得到Response的ContentType</remarks> public static string GetContentTypeByFileExtesionName(string fileExtesionName) { ContentTypesSection section = ConfigSectionFactory.GetContentTypesSection(); foreach (ContentTypeConfigElement elt in section.ContentTypes) { if (StringInCollection(fileExtesionName, elt.FileExtensionNames, true)) { return(elt.ContentType); } } return(string.Empty); }
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); }
/// <summary> /// 向页面添加配置扩展信息 /// </summary> public static void LoadConfigPageContent(bool checkAutoLoad) { PageContentSection section = ConfigSectionFactory.GetPageExtensionSection(); Page page = GetCurrentPage(); if (checkAutoLoad) { if (!section.AutoLoad) { return; } if (page.Header == null) { return; } string headerAutoLoad = page.Header.Attributes["autoLoad"]; if (headerAutoLoad.IsNotEmpty() && headerAutoLoad.ToLower() == "false") { return; } } foreach (FilePathConfigElement cssElm in section.CssClasses) { string path = cssElm.Path; if (path != string.Empty) { ClientCssManager.RegisterHeaderEndCss(page, path); } } foreach (FilePathConfigElement scriptElm in section.Scripts) { string path = scriptElm.Path; if (path != string.Empty) { DeluxeClientScriptManager.RegisterHeaderEndScript(page, path); } } }
/// <summary> /// Init HttpModule /// </summary> /// <param name="context"></param> protected virtual void Init(HttpApplication context) { _HttpModuleCollection = new Dictionary <string, IHttpModule>(); HttpModulesSection moduleSection = ConfigSectionFactory.GetHttpModulesSection(); foreach (HttpModuleAction moduleAction in moduleSection.Modules) { try { IHttpModule module = (IHttpModule)TypeCreator.CreateInstance(moduleAction.Type); this._HttpModuleCollection.Add(moduleAction.Name, module); module.Init(context); } catch (TypeLoadException ex) { ex.TryWriteAppLog(); } } }