-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #380, added case correction for query string parameters in case…
… a user-entered query string contains keys that are not the same case as those that are configured in either preservedRouteParameters or route values.
- Loading branch information
1 parent
498feab
commit b868191
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...teMapProvider/MvcSiteMapProvider/Collections/Specialized/NameValueCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
using System.Collections.Specialized; | ||
|
||
namespace MvcSiteMapProvider.Collections.Specialized | ||
{ | ||
/// <summary> | ||
/// Provides extension methods for the <see cref="T:System.Collections.Specialized.NameValueCollection"/>. | ||
/// </summary> | ||
public static class NameValueCollectionExtensions | ||
{ | ||
public static void AddWithCaseCorrection(this NameValueCollection nameValueCollection, string key, string value, IEnumerable<string> correctCaseKeyset) | ||
{ | ||
var loweredKey = key.ToLowerInvariant(); | ||
foreach (var item in correctCaseKeyset) | ||
{ | ||
if (item.ToLowerInvariant().Equals(loweredKey)) | ||
{ | ||
// Add item with corrected case key | ||
nameValueCollection.Add(item, value); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters