GetWebApplicationSection() публичный статический Метод

Returns the configuration section relating to the name provided. If the section is present in the web.config file this location is used. If it's present in the alternative configuration file then it will be return from there.
Thrown if the section does not exist and the section is mandatory.
public static GetWebApplicationSection ( string sectionName, bool isManadatory ) : ConfigurationSection
sectionName string The name of the section to be returned.
isManadatory bool True if the section is mandatary.
Результат System.Configuration.ConfigurationSection
Пример #1
0
        /// <summary>
        /// Creates a new configuration instance checking for
        /// fresh data.
        /// </summary>
        internal static void Refresh()
        {
            // Ensure the managers detection section is refreshed in case the
            // process is not going to restart as a result of the change.
            ConfigurationManager.RefreshSection("fiftyOne/redirect");

            Redirect = Support.GetWebApplicationSection("fiftyOne/redirect", false) as RedirectSection;
        }
Пример #2
0
        static Manager()
        {
            Log               = (LogSection)Support.GetWebApplicationSection("fiftyOne/log", false);
            Redirect          = (RedirectSection)Support.GetWebApplicationSection("fiftyOne/redirect", false);
            ImageOptimisation = (ImageOptimisationSection)Support.GetWebApplicationSection("fiftyOne/imageOptimisation", false);

            if (Redirect == null)
            {
                Redirect = new RedirectSection();
            }
            if (ImageOptimisation == null)
            {
                ImageOptimisation = new ImageOptimisationSection();
            }
        }