Esempio n. 1
0
        /// <summary>
        /// Creates an instance of ServerConfig from the information in the app.config file
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            HttpRuntimeConfig cfg = new HttpRuntimeConfig();

            foreach (XmlAttribute attribute in section.Attributes)
            {
                if (attribute.NodeType == XmlNodeType.Attribute)
                {
                    switch (attribute.Name)
                    {
                    case "requestLengthDiskThreshold":
                        cfg.RequestLengthDiskThreshold = Int32.Parse(attribute.Value);
                        break;

                    case "maxRequestLength":
                        cfg.MaxRequestLength = Int32.Parse(attribute.Value);
                        break;

                    case "xmlns":
                        break;

                    default:
                        HandleInvalidAttributes();
                        break;
                    }
                }
            }
            return(cfg);
        }
Esempio n. 2
0
        /// <summary>
        /// Reads the HttpRuntime configuration settings.
        /// </summary>
        /// <returns>An instance of HttpRuntimeConfig</returns>
        public static HttpRuntimeConfig GetConfig()
        {
            if (config == null)
            {
                config = ConfigurationSettings.GetConfig("httpRuntime") as HttpRuntimeConfig;

                if (config == null)
                {
                    // set up some defaults
                    config = new HttpRuntimeConfig();
                }
            }


            return(config);
        }
Esempio n. 3
0
 /// <summary>
 /// Reloads the httpRuntime configuration section from the App.Config
 /// </summary>
 public void Reload()
 {
     config = null;
     config = GetConfig();
 }
Esempio n. 4
0
 internal static void SetConfig(HttpRuntimeConfig cfg)
 {
     config = cfg;
 }