Allows write access to web.config files below an app's root.
authorQuickJack <test051102@hotmail.com>
Tue, 10 Jan 2012 20:01:16 +0000 (21:01 +0100)
committerQuickJack <test051102@hotmail.com>
Tue, 10 Jan 2012 20:01:16 +0000 (21:01 +0100)
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs

index 054f907cdba2e756571fb1053f3fbedcd193de12..5b9aef95c5466c8fe568f1707d1b6f399677d3e6 100644 (file)
@@ -360,7 +360,7 @@ namespace System.Web.Configuration
 #endif
                public virtual bool IsAboveApplication (string configPath)
                {
-                       throw new NotImplementedException ();
+                       return !configPath.Contains (HttpRuntime.AppDomainAppPath);
                }
                
                public virtual bool IsConfigRecordRequired (string configPath)
@@ -443,9 +443,9 @@ namespace System.Web.Configuration
 
                public virtual Stream OpenStreamForWrite (string streamName, string templateStreamName, ref object writeContext)
                {
-                       string rootConfigPath = GetWebConfigFileName (HttpRuntime.AppDomainAppPath);
-                       if (String.Compare (streamName, rootConfigPath, StringComparison.OrdinalIgnoreCase) == 0)
+                       if (!IsAboveApplication (streamName))
                                WebConfigurationManager.SuppressAppReload (true);
+
                        return new FileStream (streamName, FileMode.Create, FileAccess.Write);
                }
 
@@ -503,8 +503,8 @@ namespace System.Web.Configuration
                        // FileSystemWatcher monitor might have already delivered the
                        // notification. If the stream has been open using OpenStreamForWrite then
                        // we're safe, though.
-                       string rootConfigPath = GetWebConfigFileName (HttpRuntime.AppDomainAppPath);
-                       if (String.Compare (streamName, rootConfigPath, StringComparison.OrdinalIgnoreCase) == 0)
+
+                       if (!IsAboveApplication (streamName))
                                WebConfigurationManager.SuppressAppReload (true);
                }