diff options
author | Maxim Lipnin <v-maxlip@microsoft.com> | 2019-02-19 17:46:18 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-02-19 23:08:02 +0300 |
commit | c890be00c9ce7a916cf21277b5869d9eea565db7 (patch) | |
tree | 4701360426119797250a65e93d5d18a8e76eec73 /mcs/class/System.Web | |
parent | 1f33f3923a390d66098f6b3d590c9c66a2311ce2 (diff) |
use for loop to access item values and avoid InvalidCastException which occurs because VirtualDirectoryMappingCollection enumerator returns key and it's not expected
Diffstat (limited to 'mcs/class/System.Web')
-rw-r--r-- | mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs b/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs index 85942d311a4..194dfdb50b7 100644 --- a/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs +++ b/mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs @@ -272,7 +272,8 @@ namespace System.Web.Configuration { string path = NormalizeVirtualPath (virtualPath); - foreach (VirtualDirectoryMapping mapping in map.VirtualDirectories) { + for (int j = 0; j < map.VirtualDirectories.Count; j++) { + VirtualDirectoryMapping mapping = map.VirtualDirectories.Get(j); if (path.StartsWith (mapping.VirtualDirectory)) { int i = mapping.VirtualDirectory.Length; if (path.Length == i) { |