diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config
index cfc38814a6..ff42f098f7 100644
--- a/src/Umbraco.Web.UI/web.Template.Debug.config
+++ b/src/Umbraco.Web.UI/web.Template.Debug.config
@@ -84,6 +84,13 @@
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config
index b977dddc6c..f0abbfde52 100644
--- a/src/Umbraco.Web.UI/web.Template.config
+++ b/src/Umbraco.Web.UI/web.Template.config
@@ -249,6 +249,10 @@
+
+
+
+
diff --git a/src/Umbraco.Web/Editors/EntityController.cs b/src/Umbraco.Web/Editors/EntityController.cs
index 55604e0eb9..d89909d793 100644
--- a/src/Umbraco.Web/Editors/EntityController.cs
+++ b/src/Umbraco.Web/Editors/EntityController.cs
@@ -14,6 +14,7 @@ using System.Reflection;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using System.Web.Http.Controllers;
+using System.Web.Http.ModelBinding;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
@@ -605,8 +606,7 @@ namespace Umbraco.Web.Editors
}
}
- [HttpQueryStringFilter("queryStrings")]
- public IEnumerable GetAncestors(int id, UmbracoEntityTypes type, FormDataCollection queryStrings)
+ public IEnumerable GetAncestors(int id, UmbracoEntityTypes type, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
return GetResultForAncestors(id, type, queryStrings);
}
diff --git a/src/Umbraco.Web/Trees/ApplicationTreeController.cs b/src/Umbraco.Web/Trees/ApplicationTreeController.cs
index 68d7fbb3fd..162d001e96 100644
--- a/src/Umbraco.Web/Trees/ApplicationTreeController.cs
+++ b/src/Umbraco.Web/Trees/ApplicationTreeController.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
@@ -50,8 +49,7 @@ namespace Umbraco.Web.Trees
///
/// Tree use.
///
- [HttpQueryStringFilter("queryStrings")]
- public async Task GetApplicationTrees(string application, string tree, FormDataCollection queryStrings, TreeUse use = TreeUse.Main)
+ public async Task GetApplicationTrees(string application, string tree, [System.Web.Http.ModelBinding.ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings, TreeUse use = TreeUse.Main)
{
application = application.CleanForXss();
diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
index ca2f2031bb..e521deca40 100644
--- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
@@ -14,6 +14,7 @@ using Umbraco.Web.Models.Trees;
using Umbraco.Web.WebApi.Filters;
using System.Globalization;
using Umbraco.Core.Models.Entities;
+using System.Web.Http.ModelBinding;
using Umbraco.Web.Actions;
using Umbraco.Web.Composing;
@@ -30,8 +31,7 @@ namespace Umbraco.Web.Trees
///
///
///
- [HttpQueryStringFilter("queryStrings")]
- public TreeNode GetTreeNode(string id, FormDataCollection queryStrings)
+ public TreeNode GetTreeNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
int asInt;
Guid asGuid = Guid.Empty;
diff --git a/src/Umbraco.Web/Trees/MemberTreeController.cs b/src/Umbraco.Web/Trees/MemberTreeController.cs
index 430c5d2111..6107540c0c 100644
--- a/src/Umbraco.Web/Trees/MemberTreeController.cs
+++ b/src/Umbraco.Web/Trees/MemberTreeController.cs
@@ -5,6 +5,7 @@ using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Web.Http;
+using System.Web.Http.ModelBinding;
using System.Web.Security;
using Umbraco.Core;
using Umbraco.Core.Models;
@@ -49,8 +50,7 @@ namespace Umbraco.Web.Trees
///
///
///
- [HttpQueryStringFilter("queryStrings")]
- public TreeNode GetTreeNode(string id, FormDataCollection queryStrings)
+ public TreeNode GetTreeNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
var node = GetSingleTreeNode(id, queryStrings);
diff --git a/src/Umbraco.Web/Trees/TreeControllerBase.cs b/src/Umbraco.Web/Trees/TreeControllerBase.cs
index e3946ce532..f7c2b2460e 100644
--- a/src/Umbraco.Web/Trees/TreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/TreeControllerBase.cs
@@ -2,6 +2,7 @@
using System.Globalization;
using System.Linq;
using System.Net.Http.Formatting;
+using System.Web.Http.ModelBinding;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
@@ -45,7 +46,7 @@ namespace Umbraco.Web.Trees
/// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end
/// to the back end to be used in the query for model data.
///
- protected abstract TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings);
+ protected abstract TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings);
///
/// Returns the menu structure for the node
@@ -53,7 +54,7 @@ namespace Umbraco.Web.Trees
///
///
///
- protected abstract MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings);
+ protected abstract MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings);
///
/// The name to display on the root node
@@ -86,8 +87,7 @@ namespace Umbraco.Web.Trees
///
///
///
- [HttpQueryStringFilter("queryStrings")]
- public TreeNode GetRootNode(FormDataCollection queryStrings)
+ public TreeNode GetRootNode([ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
if (queryStrings == null) queryStrings = new FormDataCollection("");
var node = CreateRootNode(queryStrings);
@@ -126,8 +126,7 @@ namespace Umbraco.Web.Trees
/// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end
/// to the back end to be used in the query for model data.
///
- [HttpQueryStringFilter("queryStrings")]
- public TreeNodeCollection GetNodes(string id, FormDataCollection queryStrings)
+ public TreeNodeCollection GetNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
if (queryStrings == null) queryStrings = new FormDataCollection("");
var nodes = GetTreeNodes(id, queryStrings);
@@ -158,8 +157,7 @@ namespace Umbraco.Web.Trees
///
///
///
- [HttpQueryStringFilter("queryStrings")]
- public MenuItemCollection GetMenu(string id, FormDataCollection queryStrings)
+ public MenuItemCollection GetMenu(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))]FormDataCollection queryStrings)
{
if (queryStrings == null) queryStrings = new FormDataCollection("");
var menu = GetMenuForNode(id, queryStrings);
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 681713afa5..0dc0845ee5 100755
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -284,6 +284,7 @@
+
@@ -1058,7 +1059,6 @@
-
diff --git a/src/Umbraco.Web/WebApi/Filters/HttpQueryStringFilterAttribute.cs b/src/Umbraco.Web/WebApi/Filters/HttpQueryStringFilterAttribute.cs
deleted file mode 100644
index eea4ef7e67..0000000000
--- a/src/Umbraco.Web/WebApi/Filters/HttpQueryStringFilterAttribute.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Net.Http.Formatting;
-using System.Web.Http.Controllers;
-using System.Web.Http.Filters;
-
-namespace Umbraco.Web.WebApi.Filters
-{
- ///
- /// Allows an Action to execute with an arbitrary number of QueryStrings
- ///
- ///
- /// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number
- /// but this will allow you to do it
- ///
- public sealed class HttpQueryStringFilterAttribute : ActionFilterAttribute
- {
- public string ParameterName { get; private set; }
-
- public HttpQueryStringFilterAttribute(string parameterName)
- {
- if (string.IsNullOrEmpty(parameterName))
- throw new ArgumentException("ParameterName is required.");
- ParameterName = parameterName;
- }
-
- public override void OnActionExecuting(HttpActionContext actionContext)
- {
- //get the query strings from the request properties
- if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs"))
- {
- var queryStrings = actionContext.Request.Properties["MS_QueryNameValuePairs"] as IEnumerable>;
- if (queryStrings == null) return;
-
- var formData = new FormDataCollection(queryStrings);
-
- actionContext.ActionArguments[ParameterName] = formData;
- }
-
- base.OnActionExecuting(actionContext);
- }
- }
-}
diff --git a/src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs b/src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs
new file mode 100644
index 0000000000..6ffbb239f8
--- /dev/null
+++ b/src/Umbraco.Web/WebApi/Filters/HttpQueryStringModelBinder.cs
@@ -0,0 +1,32 @@
+using System.Collections.Generic;
+using System.Net.Http.Formatting;
+using System.Web.Http.Controllers;
+using System.Web.Http.ModelBinding;
+
+namespace Umbraco.Web.WebApi.Filters
+{
+ ///
+ /// Allows an Action to execute with an arbitrary number of QueryStrings
+ ///
+ ///
+ /// Just like you can POST an arbitrary number of parameters to an Action, you can't GET an arbitrary number
+ /// but this will allow you to do it
+ ///
+ public sealed class HttpQueryStringModelBinder : IModelBinder
+ {
+ public bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext)
+ {
+ //get the query strings from the request properties
+ if (actionContext.Request.Properties.ContainsKey("MS_QueryNameValuePairs"))
+ {
+ if (actionContext.Request.Properties["MS_QueryNameValuePairs"] is IEnumerable> queryStrings)
+ {
+ var formData = new FormDataCollection(queryStrings);
+ bindingContext.Model = formData;
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+}
\ No newline at end of file