From 57cb0851685b7fb3357f64d9b9dfada55bbf2a64 Mon Sep 17 00:00:00 2001 From: Shad Storhaug Date: Fri, 20 Sep 2013 10:18:19 +0700 Subject: [PATCH] Fixes #230, default HTTP method set incorrectly for DynamicNodes. Also added HttpMethod property to DynamicNode so HttpMethod can be set. --- .../MvcSiteMapProvider/DynamicNode.cs | 10 ++++++++++ .../MvcSiteMapProvider/SiteMapNode.cs | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/DynamicNode.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/DynamicNode.cs index 810ba971..f886faae 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/DynamicNode.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/DynamicNode.cs @@ -159,6 +159,14 @@ public UpdatePriority UpdatePriority /// The sort order. public int? Order { get; set; } + /// + /// Gets or sets the HTTP method (such as GET, POST, or HEAD). + /// + /// + /// The HTTP method. + /// + public string HttpMethod { get; set; } + /// /// Copies the values for matching properties on an instance, but /// doesn't overwrite any values that are not set in this instance. @@ -236,6 +244,8 @@ public void SafeCopyTo(ISiteMapNode node) } if (this.Order != null) node.Order = (int)this.Order; + if (!string.IsNullOrEmpty(this.HttpMethod)) + node.HttpMethod = this.HttpMethod; } diff --git a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs index 4e21ac16..d3a141cd 100644 --- a/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs +++ b/src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMapNode.cs @@ -75,6 +75,7 @@ IUrlPath urlPath protected readonly ISiteMap siteMap; protected readonly string key; protected readonly bool isDynamic; + protected string httpMethod = "*"; protected string title = String.Empty; protected string description = String.Empty; protected string imageUrl = String.Empty; @@ -114,12 +115,16 @@ public override ISiteMap SiteMap } /// - /// Gets or sets the HTTP method. + /// Gets or sets the HTTP method (such as GET, POST, or HEAD). /// /// /// The HTTP method. /// - public override string HttpMethod { get; set; } + public override string HttpMethod + { + get { return this.httpMethod; } + set { this.httpMethod = value; } + } /// /// Gets the implicit resource key (optional).