예제 #1
0
        object GetConfigInternal(string sectionName, HttpContext context, bool useLoc)
        {
            object handler = GetHandler(sectionName);
            IConfigurationSectionHandler iconf = handler as IConfigurationSectionHandler;

            if (iconf == null)
            {
                return(handler);
            }

            object parentConfig = null;

            if (parent != null)
            {
                if (useLoc)
                {
                    parentConfig = parent.GetConfig(sectionName, context);
                }
                else
                {
                    parentConfig = parent.GetConfigOptLocation(sectionName, context, false);
                }
            }

            XmlDocument doc = GetDocumentForSection(sectionName);

            if (doc == null || doc.DocumentElement == null)
            {
                return(parentConfig);
            }

            return(iconf.Create(parentConfig, fileName, doc.DocumentElement));
        }
예제 #2
0
        public object GetConfig(string sectionName, HttpContext context)
        {
            if (context == null)
            {
                return(null);
            }

            ConfigurationData config = GetConfigFromFileName(context.Request.CurrentExecutionFilePath, context);

            if (config == null)
            {
                return(null);
            }

            return(config.GetConfig(sectionName, context));
        }