2009-01-08 Marek Habersack <mhabersack@novell.com>
authorMarek Habersack <grendel@twistedcode.net>
Thu, 8 Jan 2009 00:32:37 +0000 (00:32 -0000)
committerMarek Habersack <grendel@twistedcode.net>
Thu, 8 Jan 2009 00:32:37 +0000 (00:32 -0000)
* WebConfigurationManager.cs: improve performance of
FindWebConfig.

svn path=/trunk/mcs/; revision=122730

mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs

index 91e024bd74fef1e72c60825ed5cf70220b75fa94..3dadc049501a49a7c1a4bbd7f7fd766cd73cc835 100644 (file)
@@ -1,3 +1,8 @@
+2009-01-08  Marek Habersack  <mhabersack@novell.com>
+
+       * WebConfigurationManager.cs: improve performance of
+       FindWebConfig.
+
 2009-01-07  Marek Habersack  <mhabersack@novell.com>
 
        * HttpModulesSection.cs: allow for modules with non-public
index 1a5313d20235baecaeaf4668b363e1bb3489c969..a849a9fc7c3cf7ef0219ce88a6733aad8996675e 100644 (file)
@@ -388,7 +388,19 @@ namespace System.Web.Configuration {
                
                static string FindWebConfig (string path)
                {
-                       string curPath = configPaths [path] as string;
+                       if (String.IsNullOrEmpty (path))
+                               return path;
+
+                       string dir;
+                       if (path [path.Length - 1] == '/')
+                               dir = path;
+                       else {
+                               dir = VirtualPathUtility.GetDirectory (path);
+                               if (dir == null)
+                                       return path;
+                       }
+                       
+                       string curPath = configPaths [dir] as string;
                        if (curPath != null)
                                return curPath;
                        
@@ -418,7 +430,7 @@ namespace System.Web.Configuration {
                                }
                        }
 
-                       configPaths [path] = curPath;
+                       configPaths [dir] = curPath;
                        return curPath;
                }