Просмотр исходного кода

2009-01-08 Marek Habersack <[email protected]>

	* WebConfigurationManager.cs: improve performance of
	FindWebConfig.

svn path=/trunk/mcs/; revision=122730
Marek Habersack 17 лет назад
Родитель
Сommit
10e114be23

+ 5 - 0
mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog

@@ -1,3 +1,8 @@
+2009-01-08  Marek Habersack  <[email protected]>
+
+	* WebConfigurationManager.cs: improve performance of
+	FindWebConfig.
+
 2009-01-07  Marek Habersack  <[email protected]>
 
 	* HttpModulesSection.cs: allow for modules with non-public

+ 14 - 2
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationManager.cs

@@ -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;
 		}