Skip to content

Commit

Permalink
Fixes #369, canonical URL and canonical key validation always throws …
Browse files Browse the repository at this point in the history
…an exception when using .NET Attributes.
  • Loading branch information
NightOwl888 committed Nov 2, 2014
1 parent 06b3f23 commit f300dc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down

0 comments on commit f300dc7

Please sign in to comment.