From a04df55f0ad6165f82815268e9f9efffa79e6536 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Wed, 14 Oct 2015 17:11:42 +0700 Subject: [PATCH] Changed from StringComparison.InvariantCulture to StringComparison.Ordinal for symbolic data as per Microsoft's recommendation https://msdn.microsoft.com/en-us/library/dd465121(v=vs.110).aspx. This will also help with compatibility with DNX core. --- .../MvcSiteMapProvider/Builder/SiteMapBuilderSet.cs | 2 +- .../Collections/Specialized/RouteValueDictionary.cs | 2 +- .../CompositeSiteMapNodeVisibilityProvider.cs | 2 +- src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs | 2 +- .../MvcSiteMapProvider/Web/Mvc/SiteMapHttpRequest.cs | 2 +- src/MvcSiteMapProvider/MvcSiteMapProvider/Web/UrlPath.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Builder/SiteMapBuilderSet.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Builder/SiteMapBuilderSet.cs index dd9f7c8d..095edb55 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Builder/SiteMapBuilderSet.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Builder/SiteMapBuilderSet.cs @@ -104,7 +104,7 @@ public virtual bool UseTitleIfDescriptionNotProvided public virtual bool AppliesTo(string builderSetName) { - return this.instanceName.Equals(builderSetName, StringComparison.InvariantCulture); + return this.instanceName.Equals(builderSetName, StringComparison.Ordinal); } #endregion diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs index 244f3135..e9aae2bd 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Collections/Specialized/RouteValueDictionary.cs @@ -305,7 +305,7 @@ protected virtual bool MatchesRouteValue(string key, object value) protected virtual bool MatchesValue(string key, object value) { - return this[key].ToString().Equals(value.ToString(), StringComparison.InvariantCultureIgnoreCase); + return this[key].ToString().Equals(value.ToString(), StringComparison.OrdinalIgnoreCase); } protected virtual bool IsEmptyValue(object value) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/CompositeSiteMapNodeVisibilityProvider.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/CompositeSiteMapNodeVisibilityProvider.cs index c70eaf38..e183e651 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/CompositeSiteMapNodeVisibilityProvider.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/CompositeSiteMapNodeVisibilityProvider.cs @@ -42,7 +42,7 @@ public bool IsVisible(ISiteMapNode node, IDictionary sourceMetad public bool AppliesTo(string providerName) { - return this.instanceName.Equals(providerName, StringComparison.InvariantCulture); + return this.instanceName.Equals(providerName, StringComparison.Ordinal); } #endregion diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs index e1d78761..fbac7fd5 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs @@ -899,7 +899,7 @@ protected virtual void ThrowIfHttpMethodInvalid(ISiteMapNode node) if (string.IsNullOrEmpty(node.HttpMethod) || (!EnumHelper.TryParse(node.HttpMethod, true, out verbs) && !node.HttpMethod.Equals("*") && - !node.HttpMethod.Equals("Request", StringComparison.InvariantCultureIgnoreCase))) + !node.HttpMethod.Equals("Request", StringComparison.OrdinalIgnoreCase))) { var allowedVerbs = string.Join(Environment.NewLine, Enum.GetNames(typeof(HttpVerbs))) + Environment.NewLine + "Request" + Environment.NewLine + "*"; throw new MvcSiteMapException(string.Format(Resources.Messages.SiteMapNodeHttpMethodInvalid, node.Key, node.Title, node.HttpMethod, allowedVerbs)); diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/SiteMapHttpRequest.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/SiteMapHttpRequest.cs index ccfde816..fb00ec93 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/SiteMapHttpRequest.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/Mvc/SiteMapHttpRequest.cs @@ -65,7 +65,7 @@ public override string HttpMethod { bool useRequest = this.node == null || string.Equals(this.node.HttpMethod, "*") || - string.Equals(this.node.HttpMethod, "request", StringComparison.InvariantCultureIgnoreCase); + string.Equals(this.node.HttpMethod, "request", StringComparison.OrdinalIgnoreCase); if (!useRequest) { return string.IsNullOrEmpty(this.node.HttpMethod) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/UrlPath.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/UrlPath.cs index 59991d4f..8c79f694 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/UrlPath.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/Web/UrlPath.cs @@ -389,7 +389,7 @@ public bool IsExternalUrl(string url, HttpContextBase httpContext) { var publicFacingUrl = this.GetPublicFacingUrl(httpContext); var isDifferentHost = !uri.Host.ToLowerInvariant().Equals(publicFacingUrl.Host.ToLowerInvariant()); - var isDifferentVirtualApplication = !uri.AbsolutePath.StartsWith(httpContext.Request.ApplicationPath, StringComparison.InvariantCultureIgnoreCase); + var isDifferentVirtualApplication = !uri.AbsolutePath.StartsWith(httpContext.Request.ApplicationPath, StringComparison.OrdinalIgnoreCase); return (isDifferentHost || isDifferentVirtualApplication); }