/// <summary>
		/// 得到文档类型的配置
		/// </summary>
		/// <returns>文档类型的配置信息</returns>
		public static ContentTypesSection GetConfig()
		{
			ContentTypesSection settings = (ContentTypesSection)ConfigurationBroker.GetSection("contentTypes");

			if (settings == null)
				settings = new ContentTypesSection();

			return settings;
		}
		/// <summary>
		/// 获取ContentTypesSection
		/// </summary>
		/// <returns>ContentTypesSection</returns>
		/// <remarks>获取ContentTypesSection</remarks>
		public static ContentTypesSection GetContentTypesSection()
		{
			ContentTypesSection section = (ContentTypesSection)ConfigurationBroker.GetSection("deluxe.web/contentTypes");

			if (section == null)
				section = new ContentTypesSection();

			return section;
		}
Esempio n. 3
0
        /// <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);
        }
        /// <summary>
        /// 获取ContentTypesSection
        /// </summary>
        /// <returns>ContentTypesSection</returns>
        /// <remarks>获取ContentTypesSection</remarks>
        public static ContentTypesSection GetContentTypesSection()
        {
            ContentTypesSection section = (ContentTypesSection)ConfigurationBroker.GetSection("deluxe.web/contentTypes");

            if (section == null)
            {
                section = new ContentTypesSection();
            }

            return(section);
        }
        /// <summary>
        /// 得到文档类型的配置
        /// </summary>
        /// <returns>文档类型的配置信息</returns>
        public static ContentTypesSection GetConfig()
        {
            ContentTypesSection settings = (ContentTypesSection)ConfigurationBroker.GetSection("contentTypes");

            if (settings == null)
            {
                settings = new ContentTypesSection();
            }

            return(settings);
        }
Esempio n. 6
0
        /// <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);
        }