ImageProcessor.Web.Configuration.ImageSecuritySection.GetConfiguration C# (CSharp) Method

GetConfiguration() public static method

Retrieves the security configuration section from the current application configuration.
public static GetConfiguration ( ) : ImageSecuritySection
return ImageSecuritySection
        public static ImageSecuritySection GetConfiguration()
        {
            ImageSecuritySection imageSecuritySection = ConfigurationManager.GetSection("imageProcessor/security") as ImageSecuritySection;

            if (imageSecuritySection != null)
            {
                imageSecuritySection.AutoLoadServices = false;
                return imageSecuritySection;
            }

            string section = ResourceHelpers.ResourceAsString("ImageProcessor.Web.Configuration.Resources.security.config.transform");
            XmlReader reader = new XmlTextReader(new StringReader(section));
            imageSecuritySection = new ImageSecuritySection();
            imageSecuritySection.DeserializeSection(reader);
            imageSecuritySection.AutoLoadServices = true;
            return imageSecuritySection;
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Retrieves the security configuration section from the current application configuration.
 /// </summary>
 /// <returns>The security configuration section from the current application configuration. </returns>
 internal ImageSecuritySection GetImageSecuritySection()
 {
     return(imageSecuritySection ?? (imageSecuritySection = ImageSecuritySection.GetConfiguration()));
 }
All Usage Examples Of ImageProcessor.Web.Configuration.ImageSecuritySection::GetConfiguration
ImageSecuritySection