Microsoft.Web.Administration.Configuration.GetSection C# (CSharp) Method

GetSection() public method

public GetSection ( string sectionPath ) : ConfigurationSection
sectionPath string
return ConfigurationSection
        public ConfigurationSection GetSection(string sectionPath)
        {
            return this.FileContext.GetSection(sectionPath);
        }

Same methods

Configuration::GetSection ( string sectionPath, Type type ) : ConfigurationSection
Configuration::GetSection ( string sectionPath, Type type, string locationPath ) : ConfigurationSection
Configuration::GetSection ( string sectionPath, string locationPath ) : ConfigurationSection

Usage Example

Example #1
0
        }         // SetWebSiteUploadLimitation

        private int GetWebSiteUploadLimitation(Microsoft.Web.Administration.Configuration oConfig, string sControllerAction)
        {
            int nResult = 0;

            try {
                ConfigurationSection requestFilteringSection = string.IsNullOrWhiteSpace(sControllerAction)
                                        ? oConfig.GetSection(SectionPath)
                                        : oConfig.GetSection(SectionPath, sControllerAction);

                ConfigurationElement requestLimitsElement = requestFilteringSection.GetChildElement(ElementName);

                ConfigurationAttribute oAttr = requestLimitsElement.GetAttribute(AttributeName);

                if (oAttr != null)
                {
                    int macl;

                    if (int.TryParse(oAttr.Value.ToString(), out macl))
                    {
                        nResult = macl;
                    }
                    else
                    {
                        m_oLog.Warn("Failed to parse upload limit for action '{0}'.", sControllerAction);
                    }
                }                 // if

                m_oLog.Debug("Current upload limit for action '{1}' is {0} bytes.", nResult, sControllerAction);
            }
            catch (Exception e) {
                m_oLog.Warn(e, "Failed to load upload limit for action '{0}'.", sControllerAction);
            }             // try

            return(nResult);
        } // GetWebSiteUploadLimitation
All Usage Examples Of Microsoft.Web.Administration.Configuration::GetSection