2 // System.Web.Configuration.WebConfigurationManager.cs
5 // Lluis Sanchez Gual (lluis@novell.com)
6 // Chris Toshok (toshok@ximian.com)
7 // Marek Habersack <mhabersack@novell.com>
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 // Copyright (C) 2005-2009 Novell, Inc (http://www.novell.com)
35 using System.Collections;
36 using System.Collections.Generic;
37 using System.Collections.Specialized;
38 using System.Reflection;
43 using System.Configuration;
44 using System.Configuration.Internal;
45 using _Configuration = System.Configuration.Configuration;
46 using System.Web.Util;
47 using System.Threading;
48 using System.Web.Hosting;
50 namespace System.Web.Configuration {
52 public static class WebConfigurationManager
54 sealed class ConfigPath
57 public bool InAnotherApp;
59 public ConfigPath (string path, bool inAnotherApp)
62 this.InAnotherApp = inAnotherApp;
66 const int SAVE_LOCATIONS_CHECK_INTERVAL = 6000; // milliseconds
67 const int SECTION_CACHE_LOCK_TIMEOUT = 200; // milliseconds
69 static readonly char[] pathTrimChars = { '/' };
70 static readonly object suppressAppReloadLock = new object ();
71 static readonly object saveLocationsCacheLock = new object ();
73 // See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
74 static readonly ReaderWriterLockSlim sectionCacheLock;
77 static IInternalConfigConfigurationFactory configFactory;
78 static Hashtable configurations = Hashtable.Synchronized (new Hashtable ());
79 static Hashtable configPaths = Hashtable.Synchronized (new Hashtable ());
80 static bool suppressAppReload;
82 const string AppSettingsKey = "WebConfigurationManager.AppSettings";
84 static internal IInternalConfigConfigurationFactory configFactory
87 IInternalConfigConfigurationFactory factory = (IInternalConfigConfigurationFactory)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configFactory");
89 lock (AppDomain.CurrentDomain){
90 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configFactory.initialized");
91 if (initialized == null){
92 PropertyInfo prop = typeof(ConfigurationManager).GetProperty("ConfigurationFactory", BindingFlags.Static | BindingFlags.NonPublic);
94 factory = prop.GetValue(null, null) as IInternalConfigConfigurationFactory;
95 configFactory = factory;
100 return factory != null ? factory : configFactory;
103 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configFactory", value);
104 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configFactory.initialized", true);
108 static internal Hashtable configurations
111 Hashtable table = (Hashtable)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configurations");
113 lock (AppDomain.CurrentDomain){
114 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configurations.initialized");
115 if (initialized == null){
116 table = Hashtable.Synchronized (new Hashtable (StringComparer.OrdinalIgnoreCase));
117 configurations = table;
121 return table != null ? table : configurations;
125 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configurations", value);
126 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configurations.initialized", true);
130 static Dictionary <int, object> sectionCache
134 Dictionary <int, object> sectionCache = AppDomain.CurrentDomain.GetData ("sectionCache") as Dictionary <int, object>;
135 if (sectionCache == null) {
136 sectionCache = new Dictionary <int, object> ();
137 AppDomain.CurrentDomain.SetData ("sectionCache", sectionCache);
143 AppDomain.CurrentDomain.SetData ("sectionCache", value);
147 static internal Hashtable configPaths
150 Hashtable table = (Hashtable)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configPaths");
152 lock (AppDomain.CurrentDomain){
153 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configPaths.initialized");
154 if (initialized == null){
155 table = Hashtable.Synchronized (new Hashtable (StringComparer.OrdinalIgnoreCase));
160 return table != null ? table : configPaths;
164 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configPaths", value);
165 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configPaths.initialized", true);
169 static Dictionary <string, DateTime> saveLocationsCache;
170 static Timer saveLocationsTimer;
172 static ArrayList extra_assemblies = null;
173 static internal ArrayList ExtraAssemblies {
175 if (extra_assemblies == null)
176 extra_assemblies = new ArrayList();
177 return extra_assemblies;
181 static bool hasConfigErrors = false;
182 static object hasConfigErrorsLock = new object ();
183 static internal bool HasConfigErrors {
185 lock (hasConfigErrorsLock) {
186 return hasConfigErrors;
191 const int DEFAULT_SECTION_CACHE_SIZE = 100;
192 const string CACHE_SIZE_OVERRIDING_KEY = "MONO_ASPNET_WEBCONFIG_CACHESIZE";
193 static LruCache<int, object> sectionCache;
195 static WebConfigurationManager ()
197 var section_cache_size = DEFAULT_SECTION_CACHE_SIZE;
198 int section_cache_size_override;
199 bool size_overriden = false;
200 if (int.TryParse (Environment.GetEnvironmentVariable (CACHE_SIZE_OVERRIDING_KEY), out section_cache_size_override)) {
201 section_cache_size = section_cache_size_override;
202 size_overriden = true;
203 Console.WriteLine ("WebConfigurationManager's LRUcache Size overriden to: {0} (via {1})", section_cache_size_override, CACHE_SIZE_OVERRIDING_KEY);
205 sectionCache = new LruCache<int, object> (section_cache_size);
206 string eviction_warning = "WebConfigurationManager's LRUcache evictions count reached its max size";
208 eviction_warning += String.Format ("{0}Cache Size: {1} (overridable via {2})",
209 Environment.NewLine, section_cache_size, CACHE_SIZE_OVERRIDING_KEY);
210 sectionCache.EvictionWarning = eviction_warning;
212 configFactory = ConfigurationManager.ConfigurationFactory;
213 _Configuration.SaveStart += ConfigurationSaveHandler;
214 _Configuration.SaveEnd += ConfigurationSaveHandler;
216 // Part of fix for bug #491531
217 Type type = Type.GetType ("System.Configuration.CustomizableFileSettingsProvider, System", false);
219 FieldInfo fi = type.GetField ("webConfigurationFileMapType", BindingFlags.Static | BindingFlags.NonPublic);
220 if (fi != null && fi.FieldType == Type.GetType ("System.Type"))
221 fi.SetValue (null, typeof (ApplicationSettingsConfigurationFileMap));
224 sectionCacheLock = new ReaderWriterLockSlim ();
227 static void ReenableWatcherOnConfigLocation (object state)
229 string path = state as string;
230 if (String.IsNullOrEmpty (path))
234 lock (saveLocationsCacheLock) {
235 if (!saveLocationsCache.TryGetValue (path, out lastWrite))
236 lastWrite = DateTime.MinValue;
239 DateTime now = DateTime.Now;
240 if (lastWrite == DateTime.MinValue || now.Subtract (lastWrite).TotalMilliseconds >= SAVE_LOCATIONS_CHECK_INTERVAL) {
241 saveLocationsTimer.Dispose ();
242 saveLocationsTimer = null;
243 HttpApplicationFactory.EnableWatcher (VirtualPathUtility.RemoveTrailingSlash (HttpRuntime.AppDomainAppPath), "?eb.?onfig");
245 saveLocationsTimer.Change (SAVE_LOCATIONS_CHECK_INTERVAL, SAVE_LOCATIONS_CHECK_INTERVAL);
248 static void ConfigurationSaveHandler (_Configuration sender, ConfigurationSaveEventArgs args)
251 sectionCacheLock.EnterWriteLock ();
252 sectionCache.Clear ();
254 sectionCacheLock.ExitWriteLock ();
257 lock (suppressAppReloadLock) {
258 string rootConfigPath = WebConfigurationHost.GetWebConfigFileName (HttpRuntime.AppDomainAppPath);
259 if (String.Compare (args.StreamPath, rootConfigPath, StringComparison.OrdinalIgnoreCase) == 0) {
260 SuppressAppReload (args.Start);
262 HttpApplicationFactory.DisableWatcher (VirtualPathUtility.RemoveTrailingSlash (HttpRuntime.AppDomainAppPath), "?eb.?onfig");
264 lock (saveLocationsCacheLock) {
265 if (saveLocationsCache == null)
266 saveLocationsCache = new Dictionary <string, DateTime> (StringComparer.Ordinal);
267 if (saveLocationsCache.ContainsKey (rootConfigPath))
268 saveLocationsCache [rootConfigPath] = DateTime.Now;
270 saveLocationsCache.Add (rootConfigPath, DateTime.Now);
272 if (saveLocationsTimer == null)
273 saveLocationsTimer = new Timer (ReenableWatcherOnConfigLocation,
275 SAVE_LOCATIONS_CHECK_INTERVAL,
276 SAVE_LOCATIONS_CHECK_INTERVAL);
283 public static _Configuration OpenMachineConfiguration ()
285 return ConfigurationManager.OpenMachineConfiguration ();
288 [MonoLimitation ("locationSubPath is not handled")]
289 public static _Configuration OpenMachineConfiguration (string locationSubPath)
291 return OpenMachineConfiguration ();
294 [MonoLimitation("Mono does not support remote configuration")]
295 public static _Configuration OpenMachineConfiguration (string locationSubPath,
299 return OpenMachineConfiguration (locationSubPath);
301 throw new NotSupportedException ("Mono doesn't support remote configuration");
304 [MonoLimitation("Mono does not support remote configuration")]
305 public static _Configuration OpenMachineConfiguration (string locationSubPath,
310 return OpenMachineConfiguration (locationSubPath);
311 throw new NotSupportedException ("Mono doesn't support remote configuration");
314 [MonoLimitation("Mono does not support remote configuration")]
315 public static _Configuration OpenMachineConfiguration (string locationSubPath,
321 return OpenMachineConfiguration (locationSubPath);
322 throw new NotSupportedException ("Mono doesn't support remote configuration");
325 public static _Configuration OpenWebConfiguration (string path)
327 return OpenWebConfiguration (path, null, null, null, null, null);
330 public static _Configuration OpenWebConfiguration (string path, string site)
332 return OpenWebConfiguration (path, site, null, null, null, null);
335 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath)
337 return OpenWebConfiguration (path, site, locationSubPath, null, null, null);
340 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server)
342 return OpenWebConfiguration (path, site, locationSubPath, server, null, null);
345 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, IntPtr userToken)
347 return OpenWebConfiguration (path, site, locationSubPath, server, null, null);
350 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, string userName, string password)
352 return OpenWebConfiguration (path, site, locationSubPath, server, null, null, false);
355 static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, string userName, string password, bool fweb)
357 if (String.IsNullOrEmpty (path))
360 bool inAnotherApp = false;
361 if (!fweb && !String.IsNullOrEmpty (path))
362 path = FindWebConfig (path, out inAnotherApp);
364 string confKey = path + site + locationSubPath + server + userName + password;
365 _Configuration conf = null;
366 conf = (_Configuration) configurations [confKey];
369 conf = ConfigurationFactory.Create (typeof (WebConfigurationHost), null, path, site, locationSubPath, server, userName, password, inAnotherApp);
370 configurations [confKey] = conf;
371 } catch (Exception ex) {
372 lock (hasConfigErrorsLock) {
373 hasConfigErrors = true;
381 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path)
383 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path);
386 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path, string site)
388 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path, site);
391 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path, string site, string locationSubPath)
393 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path, site, locationSubPath);
396 public static _Configuration OpenMappedMachineConfiguration (ConfigurationFileMap fileMap)
398 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap);
401 public static _Configuration OpenMappedMachineConfiguration (ConfigurationFileMap fileMap,
402 string locationSubPath)
404 return OpenMappedMachineConfiguration (fileMap);
407 internal static object SafeGetSection (string sectionName, Type configSectionType)
410 return GetSection (sectionName);
411 } catch (Exception) {
412 if (configSectionType != null)
413 return Activator.CreateInstance (configSectionType);
418 internal static object SafeGetSection (string sectionName, string path, Type configSectionType)
421 return GetSection (sectionName, path);
422 } catch (Exception) {
423 if (configSectionType != null)
424 return Activator.CreateInstance (configSectionType);
429 public static object GetSection (string sectionName)
431 HttpContext context = HttpContext.Current;
432 return GetSection (sectionName, GetCurrentPath (context), context);
435 public static object GetSection (string sectionName, string path)
437 return GetSection (sectionName, path, HttpContext.Current);
440 static bool LookUpLocation (string relativePath, ref _Configuration defaultConfiguration)
442 if (String.IsNullOrEmpty (relativePath))
445 _Configuration cnew = defaultConfiguration.FindLocationConfiguration (relativePath, defaultConfiguration);
446 if (cnew == defaultConfiguration)
449 defaultConfiguration = cnew;
453 internal static object GetSection (string sectionName, string path, HttpContext context)
455 if (String.IsNullOrEmpty (sectionName))
458 _Configuration c = OpenWebConfiguration (path, null, null, null, null, null, false);
459 string configPath = c.ConfigPath;
460 int baseCacheKey = 0;
462 bool pathPresent = !String.IsNullOrEmpty (path);
463 string locationPath = null;
466 locationPath = "location_" + path;
468 baseCacheKey = sectionName.GetHashCode ();
469 if (configPath != null)
470 baseCacheKey ^= configPath.GetHashCode ();
473 sectionCacheLock.EnterWriteLock ();
477 cacheKey = baseCacheKey ^ locationPath.GetHashCode ();
478 if (sectionCache.TryGetValue (cacheKey, out o))
481 cacheKey = baseCacheKey ^ path.GetHashCode ();
482 if (sectionCache.TryGetValue (cacheKey, out o))
486 if (sectionCache.TryGetValue (baseCacheKey, out o))
489 sectionCacheLock.ExitWriteLock ();
492 string cachePath = null;
496 if (VirtualPathUtility.IsRooted (path)) {
498 relPath = path.Length > 1 ? path.Substring (2) : String.Empty;
499 else if (path [0] == '/')
500 relPath = path.Substring (1);
506 HttpRequest req = context != null ? context.Request : null;
508 string vdir = VirtualPathUtility.GetDirectory (req.PathNoValidation);
510 vdir = vdir.TrimEnd (pathTrimChars);
511 if (String.Compare (c.ConfigPath, vdir, StringComparison.Ordinal) != 0 && LookUpLocation (vdir.Trim (pathTrimChars), ref c))
516 if (LookUpLocation (relPath, ref c))
517 cachePath = locationPath;
522 ConfigurationSection section = c.GetSection (sectionName);
527 object value = get_runtime_object.Invoke (section, new object [0]);
528 if (String.CompareOrdinal ("appSettings", sectionName) == 0) {
529 NameValueCollection collection;
530 collection = new KeyValueMergedCollection (HttpContext.Current, (NameValueCollection) value);
535 object value = SettingsMappingManager.MapSection (get_runtime_object.Invoke (section, new object [0]));
540 if (cachePath != null)
541 cacheKey = baseCacheKey ^ cachePath.GetHashCode ();
543 cacheKey = baseCacheKey;
545 AddSectionToCache (cacheKey, value);
549 static string MapPath (HttpRequest req, string virtualPath)
552 return req.MapPath (virtualPath);
554 string appRoot = HttpRuntime.AppDomainAppVirtualPath;
555 if (!String.IsNullOrEmpty (appRoot) && virtualPath.StartsWith (appRoot, StringComparison.Ordinal)) {
556 if (String.Compare (virtualPath, appRoot, StringComparison.Ordinal) == 0)
557 return HttpRuntime.AppDomainAppPath;
558 return UrlUtils.Combine (HttpRuntime.AppDomainAppPath, virtualPath.Substring (appRoot.Length));
564 static string GetParentDir (string rootPath, string curPath)
566 int len = curPath.Length - 1;
567 if (len > 0 && curPath [len] == '/')
568 curPath = curPath.Substring (0, len);
570 if (String.Compare (curPath, rootPath, StringComparison.Ordinal) == 0)
573 int idx = curPath.LastIndexOf ('/');
580 return curPath.Substring (0, idx);
583 internal static string FindWebConfig (string path)
587 return FindWebConfig (path, out dummy);
590 internal static string FindWebConfig (string path, out bool inAnotherApp)
592 inAnotherApp = false;
594 if (String.IsNullOrEmpty (path))
597 if (HostingEnvironment.VirtualPathProvider != null) {
598 if (HostingEnvironment.VirtualPathProvider.DirectoryExists (path))
599 path = VirtualPathUtility.AppendTrailingSlash (path);
603 string rootPath = HttpRuntime.AppDomainAppVirtualPath;
605 curPath = configPaths [path] as ConfigPath;
606 if (curPath != null) {
607 inAnotherApp = curPath.InAnotherApp;
611 HttpContext ctx = HttpContext.Current;
612 HttpRequest req = ctx != null ? ctx.Request : null;
613 string physPath = req != null ? VirtualPathUtility.AppendTrailingSlash (MapPath (req, path)) : null;
614 string appDomainPath = HttpRuntime.AppDomainAppPath;
616 if (physPath != null && appDomainPath != null && !physPath.StartsWith (appDomainPath, StringComparison.Ordinal))
620 if (inAnotherApp || path [path.Length - 1] == '/')
623 dir = VirtualPathUtility.GetDirectory (path, false);
628 curPath = configPaths [dir] as ConfigPath;
629 if (curPath != null) {
630 inAnotherApp = curPath.InAnotherApp;
637 curPath = new ConfigPath (path, inAnotherApp);
638 while (String.Compare (curPath.Path, rootPath, StringComparison.Ordinal) != 0) {
639 physPath = MapPath (req, curPath.Path);
640 if (physPath == null) {
641 curPath.Path = rootPath;
645 if (WebConfigurationHost.GetWebConfigFileName (physPath) != null)
648 curPath.Path = GetParentDir (rootPath, curPath.Path);
649 if (curPath.Path == null || curPath.Path == "~") {
650 curPath.Path = rootPath;
655 if (String.Compare (curPath.Path, path, StringComparison.Ordinal) != 0)
656 configPaths [path] = curPath;
658 configPaths [dir] = curPath;
663 static string GetCurrentPath (HttpContext ctx)
665 HttpRequest req = ctx != null ? ctx.Request : null;
666 return req != null ? req.PathNoValidation : HttpRuntime.AppDomainAppVirtualPath;
669 internal static bool SuppressAppReload (bool newValue)
673 lock (suppressAppReloadLock) {
674 ret = suppressAppReload;
675 suppressAppReload = newValue;
681 internal static void RemoveConfigurationFromCache (HttpContext ctx)
683 configurations.Remove (GetCurrentPath (ctx));
686 #if TARGET_J2EE || MONOWEB_DEP
687 readonly static MethodInfo get_runtime_object = typeof (ConfigurationSection).GetMethod ("GetRuntimeObject", BindingFlags.NonPublic | BindingFlags.Instance);
690 public static object GetWebApplicationSection (string sectionName)
692 HttpContext ctx = HttpContext.Current;
693 HttpRequest req = ctx != null ? ctx.Request : null;
694 string applicationPath = req != null ? req.ApplicationPath : null;
695 return GetSection (sectionName, String.IsNullOrEmpty (applicationPath) ? String.Empty : applicationPath);
698 public static NameValueCollection AppSettings {
699 get { return ConfigurationManager.AppSettings; }
702 public static ConnectionStringSettingsCollection ConnectionStrings {
703 get { return ConfigurationManager.ConnectionStrings; }
706 internal static IInternalConfigConfigurationFactory ConfigurationFactory {
707 get { return configFactory; }
710 static void AddSectionToCache (int key, object section)
712 object cachedSection;
716 if (!sectionCacheLock.TryEnterWriteLock (SECTION_CACHE_LOCK_TIMEOUT))
720 if (sectionCache.TryGetValue (key, out cachedSection) && cachedSection != null)
723 sectionCache.Add (key, section);
726 sectionCacheLock.ExitWriteLock ();
731 #region stuff copied from WebConfigurationSettings
733 static internal IConfigurationSystem oldConfig {
735 return (IConfigurationSystem)AppDomain.CurrentDomain.GetData("WebConfigurationManager.oldConfig");
738 AppDomain.CurrentDomain.SetData("WebConfigurationManager.oldConfig", value);
742 static Web20DefaultConfig config {
744 return (Web20DefaultConfig) AppDomain.CurrentDomain.GetData ("Web20DefaultConfig.config");
747 AppDomain.CurrentDomain.SetData ("Web20DefaultConfig.config", value);
751 static IInternalConfigSystem configSystem {
753 return (IInternalConfigSystem) AppDomain.CurrentDomain.GetData ("IInternalConfigSystem.configSystem");
756 AppDomain.CurrentDomain.SetData ("IInternalConfigSystem.configSystem", value);
760 static internal IConfigurationSystem oldConfig;
761 static Web20DefaultConfig config;
762 //static IInternalConfigSystem configSystem;
764 const BindingFlags privStatic = BindingFlags.NonPublic | BindingFlags.Static;
765 static readonly object lockobj = new object ();
767 internal static void Init ()
773 /* deal with the ConfigurationSettings stuff */
775 Web20DefaultConfig settings = Web20DefaultConfig.GetInstance ();
776 Type t = typeof (ConfigurationSettings);
777 MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
780 if (changeConfig == null)
781 throw new ConfigurationException ("Cannot find method CCS");
783 object [] args = new object [] {settings};
784 oldConfig = (IConfigurationSystem)changeConfig.Invoke (null, args);
790 /* deal with the ConfigurationManager stuff */
792 HttpConfigurationSystem system = new HttpConfigurationSystem ();
793 Type t = typeof (ConfigurationManager);
794 MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
797 if (changeConfig == null)
798 throw new ConfigurationException ("Cannot find method CCS");
800 object [] args = new object [] {system};
801 changeConfig.Invoke (null, args);
802 //configSystem = system;
808 class Web20DefaultConfig : IConfigurationSystem
811 static Web20DefaultConfig instance {
813 Web20DefaultConfig val = (Web20DefaultConfig)AppDomain.CurrentDomain.GetData("Web20DefaultConfig.instance");
815 val = new Web20DefaultConfig();
816 AppDomain.CurrentDomain.SetData("Web20DefaultConfig.instance", val);
821 AppDomain.CurrentDomain.SetData("Web20DefaultConfig.instance", value);
825 static Web20DefaultConfig instance;
828 static Web20DefaultConfig ()
830 instance = new Web20DefaultConfig ();
833 public static Web20DefaultConfig GetInstance ()
838 public object GetConfig (string sectionName)
840 object o = WebConfigurationManager.GetWebApplicationSection (sectionName);
842 if (o == null || o is IgnoreSection) {
843 /* this can happen when the section
844 * handler doesn't subclass from
845 * ConfigurationSection. let's be
846 * nice and try to load it using the
847 * 1.x style routines in case there's
848 * a 1.x section handler registered
851 object o1 = WebConfigurationManager.oldConfig.GetConfig (sectionName);
861 // nothing. We need a context.