コード例 #1
0
ファイル: Configuration.cs プロジェクト: waffle-iron/nequeo
        /// <summary>
        /// Gets sets, the http handler state elements.
        /// </summary>
        /// <param name="section">The config section group and section name.</param>
        /// <returns>The http handler collection; else null.</returns>
        public static HttpHandlerDataExtensionElement[] HttpHandlerExtensionElements(string section = "HttpHandlerExtensionGroup/HttpHandlerDataExtensions")
        {
            // Refreshes the named section so the next time that it is retrieved it will be re-read from disk.
            System.Configuration.ConfigurationManager.RefreshSection(section);

            // Get the default element
            // configuration information
            // from the configuration manager.
            HttpHandlerDataExtensions baseHandler =
                (HttpHandlerDataExtensions)System.Configuration.ConfigurationManager.GetSection(section);

            // Return the collection.
            HttpHandlerDataExtensionElement[] items = new HttpHandlerDataExtensionElement[baseHandler.HostSection.Count];
            baseHandler.HostSection.CopyTo(items, 0);
            return(items.Where(q => (q.Name != "default")).ToArray());
        }
コード例 #2
0
ファイル: Configuration.cs プロジェクト: waffle-iron/nequeo
        /// <summary>
        /// Gets, the http handler extension collection elements.
        /// </summary>
        /// <param name="section">The config section group and section name.</param>
        /// <returns>The http handler collection; else null.</returns>
        public static HttpHandlerDataCollection HttpHandlerCollection(string section = "HttpHandlerExtensionGroup/HttpHandlerDataExtensions")
        {
            try
            {
                // Refreshes the named section so the next time that it is retrieved it will be re-read from disk.
                System.Configuration.ConfigurationManager.RefreshSection(section);

                // Get the default element
                // configuration information
                // from the configuration manager.
                HttpHandlerDataExtensions baseHandler =
                    (HttpHandlerDataExtensions)System.Configuration.ConfigurationManager.GetSection(section);

                // Return the element.
                return(baseHandler.HostSection);
            }
            catch { }
            {
                return(null);
            }
        }