From e625905a7158eaea3bce20ee138db37b17a3756d Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Sun, 9 Feb 2014 16:22:00 +0700 Subject: [PATCH] Fixed FilteredSiteMapVisibilityProvider so it will ignore white-space between the keywords and separator characters. --- .../FilteredSiteMapNodeVisibilityProvider.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/FilteredSiteMapNodeVisibilityProvider.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/FilteredSiteMapNodeVisibilityProvider.cs index e4c2fc6d..2be36bfb 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/FilteredSiteMapNodeVisibilityProvider.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/FilteredSiteMapNodeVisibilityProvider.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Web; namespace MvcSiteMapProvider @@ -57,8 +58,9 @@ public override bool IsVisible(ISiteMapNode node, IDictionary so // Chop off the namespace htmlHelper = htmlHelper.Substring(htmlHelper.LastIndexOf(".") + 1); - // Get the keywords - var visibilityKeywords = visibility.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); + // Get the keywords and trim any white-spaces + var visibilityKeywords = visibility.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries) + .Select(k => k.Trim()).ToList(); // All set. Now parse the visibility variable. foreach (string visibilityKeyword in visibilityKeywords)