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

GetSection() public method

public GetSection ( string sectionPath, Type type ) : ConfigurationSection
sectionPath string
type System.Type
return ConfigurationSection
        public ConfigurationSection GetSection(string sectionPath, Type type)
        {
            return FileContext.GetSection(sectionPath, type);
        }

Same methods

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

Usage Example

Beispiel #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