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 Dictionary <int, object> sectionCache = new Dictionary <int, object> ();
80 static Hashtable configPaths = Hashtable.Synchronized (new Hashtable ());
81 static bool suppressAppReload;
83 const string AppSettingsKey = "WebConfigurationManager.AppSettings";
85 static internal IInternalConfigConfigurationFactory configFactory
88 IInternalConfigConfigurationFactory factory = (IInternalConfigConfigurationFactory)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configFactory");
90 lock (AppDomain.CurrentDomain){
91 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configFactory.initialized");
92 if (initialized == null){
93 PropertyInfo prop = typeof(ConfigurationManager).GetProperty("ConfigurationFactory", BindingFlags.Static | BindingFlags.NonPublic);
95 factory = prop.GetValue(null, null) as IInternalConfigConfigurationFactory;
96 configFactory = factory;
101 return factory != null ? factory : configFactory;
104 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configFactory", value);
105 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configFactory.initialized", true);
109 static internal Hashtable configurations
112 Hashtable table = (Hashtable)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configurations");
114 lock (AppDomain.CurrentDomain){
115 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configurations.initialized");
116 if (initialized == null){
117 table = Hashtable.Synchronized (new Hashtable (StringComparer.OrdinalIgnoreCase));
118 configurations = table;
122 return table != null ? table : configurations;
126 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configurations", value);
127 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configurations.initialized", true);
131 static Dictionary <int, object> sectionCache
135 Dictionary <int, object> sectionCache = AppDomain.CurrentDomain.GetData ("sectionCache") as Dictionary <int, object>;
136 if (sectionCache == null) {
137 sectionCache = new Dictionary <int, object> ();
138 AppDomain.CurrentDomain.SetData ("sectionCache", sectionCache);
144 AppDomain.CurrentDomain.SetData ("sectionCache", value);
148 static internal Hashtable configPaths
151 Hashtable table = (Hashtable)AppDomain.CurrentDomain.GetData("WebConfigurationManager.configPaths");
153 lock (AppDomain.CurrentDomain){
154 object initialized = AppDomain.CurrentDomain.GetData("WebConfigurationManager.configPaths.initialized");
155 if (initialized == null){
156 table = Hashtable.Synchronized (new Hashtable (StringComparer.OrdinalIgnoreCase));
161 return table != null ? table : configPaths;
165 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configPaths", value);
166 AppDomain.CurrentDomain.SetData("WebConfigurationManager.configPaths.initialized", true);
170 static Dictionary <string, DateTime> saveLocationsCache;
171 static Timer saveLocationsTimer;
173 static ArrayList extra_assemblies = null;
174 static internal ArrayList ExtraAssemblies {
176 if (extra_assemblies == null)
177 extra_assemblies = new ArrayList();
178 return extra_assemblies;
182 static bool hasConfigErrors = false;
183 static object hasConfigErrorsLock = new object ();
184 static internal bool HasConfigErrors {
186 lock (hasConfigErrorsLock) {
187 return hasConfigErrors;
192 static WebConfigurationManager ()
194 configFactory = ConfigurationManager.ConfigurationFactory;
195 _Configuration.SaveStart += ConfigurationSaveHandler;
196 _Configuration.SaveEnd += ConfigurationSaveHandler;
198 // Part of fix for bug #491531
199 Type type = Type.GetType ("System.Configuration.CustomizableFileSettingsProvider, System", false);
201 FieldInfo fi = type.GetField ("webConfigurationFileMapType", BindingFlags.Static | BindingFlags.NonPublic);
202 if (fi != null && fi.FieldType == Type.GetType ("System.Type"))
203 fi.SetValue (null, typeof (ApplicationSettingsConfigurationFileMap));
206 sectionCacheLock = new ReaderWriterLockSlim ();
209 static void ReenableWatcherOnConfigLocation (object state)
211 string path = state as string;
212 if (String.IsNullOrEmpty (path))
216 lock (saveLocationsCacheLock) {
217 if (!saveLocationsCache.TryGetValue (path, out lastWrite))
218 lastWrite = DateTime.MinValue;
221 DateTime now = DateTime.Now;
222 if (lastWrite == DateTime.MinValue || now.Subtract (lastWrite).TotalMilliseconds >= SAVE_LOCATIONS_CHECK_INTERVAL) {
223 saveLocationsTimer.Dispose ();
224 saveLocationsTimer = null;
225 HttpApplicationFactory.EnableWatcher (VirtualPathUtility.RemoveTrailingSlash (HttpRuntime.AppDomainAppPath), "?eb.?onfig");
227 saveLocationsTimer.Change (SAVE_LOCATIONS_CHECK_INTERVAL, SAVE_LOCATIONS_CHECK_INTERVAL);
230 static void ConfigurationSaveHandler (_Configuration sender, ConfigurationSaveEventArgs args)
233 sectionCacheLock.EnterWriteLock ();
234 sectionCache.Clear ();
236 sectionCacheLock.ExitWriteLock ();
239 lock (suppressAppReloadLock) {
240 string rootConfigPath = WebConfigurationHost.GetWebConfigFileName (HttpRuntime.AppDomainAppPath);
241 if (String.Compare (args.StreamPath, rootConfigPath, StringComparison.OrdinalIgnoreCase) == 0) {
242 SuppressAppReload (args.Start);
244 HttpApplicationFactory.DisableWatcher (VirtualPathUtility.RemoveTrailingSlash (HttpRuntime.AppDomainAppPath), "?eb.?onfig");
246 lock (saveLocationsCacheLock) {
247 if (saveLocationsCache == null)
248 saveLocationsCache = new Dictionary <string, DateTime> (StringComparer.Ordinal);
249 if (saveLocationsCache.ContainsKey (rootConfigPath))
250 saveLocationsCache [rootConfigPath] = DateTime.Now;
252 saveLocationsCache.Add (rootConfigPath, DateTime.Now);
254 if (saveLocationsTimer == null)
255 saveLocationsTimer = new Timer (ReenableWatcherOnConfigLocation,
257 SAVE_LOCATIONS_CHECK_INTERVAL,
258 SAVE_LOCATIONS_CHECK_INTERVAL);
265 public static _Configuration OpenMachineConfiguration ()
267 return ConfigurationManager.OpenMachineConfiguration ();
270 [MonoLimitation ("locationSubPath is not handled")]
271 public static _Configuration OpenMachineConfiguration (string locationSubPath)
273 return OpenMachineConfiguration ();
276 [MonoLimitation("Mono does not support remote configuration")]
277 public static _Configuration OpenMachineConfiguration (string locationSubPath,
281 return OpenMachineConfiguration (locationSubPath);
283 throw new NotSupportedException ("Mono doesn't support remote configuration");
286 [MonoLimitation("Mono does not support remote configuration")]
287 public static _Configuration OpenMachineConfiguration (string locationSubPath,
292 return OpenMachineConfiguration (locationSubPath);
293 throw new NotSupportedException ("Mono doesn't support remote configuration");
296 [MonoLimitation("Mono does not support remote configuration")]
297 public static _Configuration OpenMachineConfiguration (string locationSubPath,
303 return OpenMachineConfiguration (locationSubPath);
304 throw new NotSupportedException ("Mono doesn't support remote configuration");
307 public static _Configuration OpenWebConfiguration (string path)
309 return OpenWebConfiguration (path, null, null, null, null, null);
312 public static _Configuration OpenWebConfiguration (string path, string site)
314 return OpenWebConfiguration (path, site, null, null, null, null);
317 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath)
319 return OpenWebConfiguration (path, site, locationSubPath, null, null, null);
322 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server)
324 return OpenWebConfiguration (path, site, locationSubPath, server, null, null);
327 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, IntPtr userToken)
329 return OpenWebConfiguration (path, site, locationSubPath, server, null, null);
332 public static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, string userName, string password)
334 return OpenWebConfiguration (path, site, locationSubPath, server, null, null, false);
337 static _Configuration OpenWebConfiguration (string path, string site, string locationSubPath, string server, string userName, string password, bool fweb)
339 if (String.IsNullOrEmpty (path))
342 bool inAnotherApp = false;
343 if (!fweb && !String.IsNullOrEmpty (path))
344 path = FindWebConfig (path, out inAnotherApp);
346 string confKey = path + site + locationSubPath + server + userName + password;
347 _Configuration conf = null;
348 conf = (_Configuration) configurations [confKey];
351 conf = ConfigurationFactory.Create (typeof (WebConfigurationHost), null, path, site, locationSubPath, server, userName, password, inAnotherApp);
352 configurations [confKey] = conf;
353 } catch (Exception ex) {
354 lock (hasConfigErrorsLock) {
355 hasConfigErrors = true;
363 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path)
365 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path);
368 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path, string site)
370 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path, site);
373 public static _Configuration OpenMappedWebConfiguration (WebConfigurationFileMap fileMap, string path, string site, string locationSubPath)
375 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap, path, site, locationSubPath);
378 public static _Configuration OpenMappedMachineConfiguration (ConfigurationFileMap fileMap)
380 return ConfigurationFactory.Create (typeof(WebConfigurationHost), fileMap);
383 public static _Configuration OpenMappedMachineConfiguration (ConfigurationFileMap fileMap,
384 string locationSubPath)
386 return OpenMappedMachineConfiguration (fileMap);
389 internal static object SafeGetSection (string sectionName, Type configSectionType)
392 return GetSection (sectionName);
393 } catch (Exception) {
394 if (configSectionType != null)
395 return Activator.CreateInstance (configSectionType);
400 internal static object SafeGetSection (string sectionName, string path, Type configSectionType)
403 return GetSection (sectionName, path);
404 } catch (Exception) {
405 if (configSectionType != null)
406 return Activator.CreateInstance (configSectionType);
411 public static object GetSection (string sectionName)
413 HttpContext context = HttpContext.Current;
414 return GetSection (sectionName, GetCurrentPath (context), context);
417 public static object GetSection (string sectionName, string path)
419 return GetSection (sectionName, path, HttpContext.Current);
422 static bool LookUpLocation (string relativePath, ref _Configuration defaultConfiguration)
424 if (String.IsNullOrEmpty (relativePath))
427 _Configuration cnew = defaultConfiguration.FindLocationConfiguration (relativePath, defaultConfiguration);
428 if (cnew == defaultConfiguration)
431 defaultConfiguration = cnew;
435 internal static object GetSection (string sectionName, string path, HttpContext context)
437 if (String.IsNullOrEmpty (sectionName))
440 _Configuration c = OpenWebConfiguration (path, null, null, null, null, null, false);
441 string configPath = c.ConfigPath;
442 int baseCacheKey = 0;
444 bool pathPresent = !String.IsNullOrEmpty (path);
445 string locationPath = null;
448 locationPath = "location_" + path;
450 baseCacheKey = sectionName.GetHashCode ();
451 if (configPath != null)
452 baseCacheKey ^= configPath.GetHashCode ();
455 sectionCacheLock.EnterReadLock ();
459 cacheKey = baseCacheKey ^ locationPath.GetHashCode ();
460 if (sectionCache.TryGetValue (cacheKey, out o))
463 cacheKey = baseCacheKey ^ path.GetHashCode ();
464 if (sectionCache.TryGetValue (cacheKey, out o))
468 if (sectionCache.TryGetValue (baseCacheKey, out o))
471 sectionCacheLock.ExitReadLock ();
474 string cachePath = null;
478 if (VirtualPathUtility.IsRooted (path)) {
480 relPath = path.Length > 1 ? path.Substring (2) : String.Empty;
481 else if (path [0] == '/')
482 relPath = path.Substring (1);
488 HttpRequest req = context != null ? context.Request : null;
490 string vdir = VirtualPathUtility.GetDirectory (req.PathNoValidation);
492 vdir = vdir.TrimEnd (pathTrimChars);
493 if (String.Compare (c.ConfigPath, vdir, StringComparison.Ordinal) != 0 && LookUpLocation (vdir.Trim (pathTrimChars), ref c))
498 if (LookUpLocation (relPath, ref c))
499 cachePath = locationPath;
504 ConfigurationSection section = c.GetSection (sectionName);
509 object value = get_runtime_object.Invoke (section, new object [0]);
510 if (String.CompareOrdinal ("appSettings", sectionName) == 0) {
511 NameValueCollection collection;
512 collection = new KeyValueMergedCollection (HttpContext.Current, (NameValueCollection) value);
517 object value = SettingsMappingManager.MapSection (get_runtime_object.Invoke (section, new object [0]));
522 if (cachePath != null)
523 cacheKey = baseCacheKey ^ cachePath.GetHashCode ();
525 cacheKey = baseCacheKey;
527 AddSectionToCache (cacheKey, value);
531 static string MapPath (HttpRequest req, string virtualPath)
534 return req.MapPath (virtualPath);
536 string appRoot = HttpRuntime.AppDomainAppVirtualPath;
537 if (!String.IsNullOrEmpty (appRoot) && virtualPath.StartsWith (appRoot, StringComparison.Ordinal)) {
538 if (String.Compare (virtualPath, appRoot, StringComparison.Ordinal) == 0)
539 return HttpRuntime.AppDomainAppPath;
540 return UrlUtils.Combine (HttpRuntime.AppDomainAppPath, virtualPath.Substring (appRoot.Length));
546 static string GetParentDir (string rootPath, string curPath)
548 int len = curPath.Length - 1;
549 if (len > 0 && curPath [len] == '/')
550 curPath = curPath.Substring (0, len);
552 if (String.Compare (curPath, rootPath, StringComparison.Ordinal) == 0)
555 int idx = curPath.LastIndexOf ('/');
562 return curPath.Substring (0, idx);
565 internal static string FindWebConfig (string path)
569 return FindWebConfig (path, out dummy);
572 internal static string FindWebConfig (string path, out bool inAnotherApp)
574 inAnotherApp = false;
576 if (String.IsNullOrEmpty (path))
579 if (HostingEnvironment.VirtualPathProvider != null) {
580 if (HostingEnvironment.VirtualPathProvider.DirectoryExists (path))
581 path = VirtualPathUtility.AppendTrailingSlash (path);
585 string rootPath = HttpRuntime.AppDomainAppVirtualPath;
587 curPath = configPaths [path] as ConfigPath;
588 if (curPath != null) {
589 inAnotherApp = curPath.InAnotherApp;
593 HttpContext ctx = HttpContext.Current;
594 HttpRequest req = ctx != null ? ctx.Request : null;
595 string physPath = req != null ? VirtualPathUtility.AppendTrailingSlash (MapPath (req, path)) : null;
596 string appDomainPath = HttpRuntime.AppDomainAppPath;
598 if (physPath != null && appDomainPath != null && !physPath.StartsWith (appDomainPath, StringComparison.Ordinal))
602 if (inAnotherApp || path [path.Length - 1] == '/')
605 dir = VirtualPathUtility.GetDirectory (path, false);
610 curPath = configPaths [dir] as ConfigPath;
611 if (curPath != null) {
612 inAnotherApp = curPath.InAnotherApp;
619 curPath = new ConfigPath (path, inAnotherApp);
620 while (String.Compare (curPath.Path, rootPath, StringComparison.Ordinal) != 0) {
621 physPath = MapPath (req, curPath.Path);
622 if (physPath == null) {
623 curPath.Path = rootPath;
627 if (WebConfigurationHost.GetWebConfigFileName (physPath) != null)
630 curPath.Path = GetParentDir (rootPath, curPath.Path);
631 if (curPath.Path == null || curPath.Path == "~") {
632 curPath.Path = rootPath;
637 if (String.Compare (curPath.Path, path, StringComparison.Ordinal) != 0)
638 configPaths [path] = curPath;
640 configPaths [dir] = curPath;
645 static string GetCurrentPath (HttpContext ctx)
647 HttpRequest req = ctx != null ? ctx.Request : null;
648 return req != null ? req.PathNoValidation : HttpRuntime.AppDomainAppVirtualPath;
651 internal static bool SuppressAppReload (bool newValue)
655 lock (suppressAppReloadLock) {
656 ret = suppressAppReload;
657 suppressAppReload = newValue;
663 internal static void RemoveConfigurationFromCache (HttpContext ctx)
665 configurations.Remove (GetCurrentPath (ctx));
668 #if TARGET_J2EE || MONOWEB_DEP
669 readonly static MethodInfo get_runtime_object = typeof (ConfigurationSection).GetMethod ("GetRuntimeObject", BindingFlags.NonPublic | BindingFlags.Instance);
672 public static object GetWebApplicationSection (string sectionName)
674 HttpContext ctx = HttpContext.Current;
675 HttpRequest req = ctx != null ? ctx.Request : null;
676 string applicationPath = req != null ? req.ApplicationPath : null;
677 return GetSection (sectionName, String.IsNullOrEmpty (applicationPath) ? String.Empty : applicationPath);
680 public static NameValueCollection AppSettings {
681 get { return ConfigurationManager.AppSettings; }
684 public static ConnectionStringSettingsCollection ConnectionStrings {
685 get { return ConfigurationManager.ConnectionStrings; }
688 internal static IInternalConfigConfigurationFactory ConfigurationFactory {
689 get { return configFactory; }
692 static void AddSectionToCache (int key, object section)
694 object cachedSection;
697 if (!sectionCacheLock.TryEnterUpgradeableReadLock (SECTION_CACHE_LOCK_TIMEOUT))
700 if (sectionCache.TryGetValue (key, out cachedSection) && cachedSection != null)
704 if (!sectionCacheLock.TryEnterWriteLock (SECTION_CACHE_LOCK_TIMEOUT))
706 sectionCache.Add (key, section);
709 sectionCacheLock.ExitWriteLock ();
710 } catch (SynchronizationLockException) {
711 // we can ignore it here
716 sectionCacheLock.ExitUpgradeableReadLock ();
717 } catch (SynchronizationLockException) {
718 // we can ignore it here
723 #region stuff copied from WebConfigurationSettings
725 static internal IConfigurationSystem oldConfig {
727 return (IConfigurationSystem)AppDomain.CurrentDomain.GetData("WebConfigurationManager.oldConfig");
730 AppDomain.CurrentDomain.SetData("WebConfigurationManager.oldConfig", value);
734 static Web20DefaultConfig config {
736 return (Web20DefaultConfig) AppDomain.CurrentDomain.GetData ("Web20DefaultConfig.config");
739 AppDomain.CurrentDomain.SetData ("Web20DefaultConfig.config", value);
743 static IInternalConfigSystem configSystem {
745 return (IInternalConfigSystem) AppDomain.CurrentDomain.GetData ("IInternalConfigSystem.configSystem");
748 AppDomain.CurrentDomain.SetData ("IInternalConfigSystem.configSystem", value);
752 static internal IConfigurationSystem oldConfig;
753 static Web20DefaultConfig config;
754 //static IInternalConfigSystem configSystem;
756 const BindingFlags privStatic = BindingFlags.NonPublic | BindingFlags.Static;
757 static readonly object lockobj = new object ();
759 internal static void Init ()
765 /* deal with the ConfigurationSettings stuff */
767 Web20DefaultConfig settings = Web20DefaultConfig.GetInstance ();
768 Type t = typeof (ConfigurationSettings);
769 MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
772 if (changeConfig == null)
773 throw new ConfigurationException ("Cannot find method CCS");
775 object [] args = new object [] {settings};
776 oldConfig = (IConfigurationSystem)changeConfig.Invoke (null, args);
782 /* deal with the ConfigurationManager stuff */
784 HttpConfigurationSystem system = new HttpConfigurationSystem ();
785 Type t = typeof (ConfigurationManager);
786 MethodInfo changeConfig = t.GetMethod ("ChangeConfigurationSystem",
789 if (changeConfig == null)
790 throw new ConfigurationException ("Cannot find method CCS");
792 object [] args = new object [] {system};
793 changeConfig.Invoke (null, args);
794 //configSystem = system;
800 class Web20DefaultConfig : IConfigurationSystem
803 static Web20DefaultConfig instance {
805 Web20DefaultConfig val = (Web20DefaultConfig)AppDomain.CurrentDomain.GetData("Web20DefaultConfig.instance");
807 val = new Web20DefaultConfig();
808 AppDomain.CurrentDomain.SetData("Web20DefaultConfig.instance", val);
813 AppDomain.CurrentDomain.SetData("Web20DefaultConfig.instance", value);
817 static Web20DefaultConfig instance;
820 static Web20DefaultConfig ()
822 instance = new Web20DefaultConfig ();
825 public static Web20DefaultConfig GetInstance ()
830 public object GetConfig (string sectionName)
832 object o = WebConfigurationManager.GetWebApplicationSection (sectionName);
834 if (o == null || o is IgnoreSection) {
835 /* this can happen when the section
836 * handler doesn't subclass from
837 * ConfigurationSection. let's be
838 * nice and try to load it using the
839 * 1.x style routines in case there's
840 * a 1.x section handler registered
843 object o1 = WebConfigurationManager.oldConfig.GetConfig (sectionName);
853 // nothing. We need a context.