From f300dc7e40eb1000ce8a759194707091cce71303 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Sun, 2 Nov 2014 14:34:35 +0700 Subject: [PATCH] Fixes #369, canonical URL and canonical key validation always throws an exception when using .NET Attributes. --- src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs index 0aabf694..872874a0 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs @@ -465,7 +465,7 @@ public override string CanonicalKey { if (!this.canonicalKey.Equals(value)) { - if (!string.IsNullOrEmpty(this.canonicalUrl)) + if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(this.canonicalUrl)) { throw new ArgumentException(string.Format(Resources.Messages.SiteMapNodeCanonicalValueAlreadySet, "CanonicalKey"), "CanonicalKey"); } @@ -497,7 +497,7 @@ public override string CanonicalUrl { if (!this.canonicalUrl.Equals(value)) { - if (!string.IsNullOrEmpty(this.canonicalKey)) + if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(this.canonicalKey)) { throw new ArgumentException(string.Format(Resources.Messages.SiteMapNodeCanonicalValueAlreadySet, "CanonicalUrl"), "CanonicalUrl"); }