/// <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); }
/// <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); }
/// <summary> /// Reloads the httpRuntime configuration section from the App.Config /// </summary> public void Reload() { config = null; config = GetConfig(); }
internal static void SetConfig(HttpRuntimeConfig cfg) { config = cfg; }