diff --git a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
index 12a5d6d736..4e7f06cf06 100644
--- a/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
+++ b/src/Umbraco.Web/HtmlHelperRenderExtensions.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
+using System.Web.Routing;
using Umbraco.Core;
using Umbraco.Core.Dynamics;
using Umbraco.Web.Mvc;
@@ -83,6 +84,48 @@ namespace Umbraco.Web
return filteredHtmlHelper.ValidationSummary(excludePropertyErrors, message, htmlAttributes);
}
+ ///
+ /// Returns the result of a child action of a strongly typed SurfaceController
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IHtmlString Action(this HtmlHelper htmlHelper, string actionName)
+ where T : SurfaceController
+ {
+ return htmlHelper.Action(actionName, typeof(T));
+ }
+
+ ///
+ /// Returns the result of a child action of a SurfaceController
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IHtmlString Action(this HtmlHelper htmlHelper, string actionName, Type surfaceType)
+ {
+ Mandate.ParameterNotNull(surfaceType, "surfaceType");
+ Mandate.ParameterNotNullOrEmpty(actionName, "actionName");
+
+ var routeVals = new RouteValueDictionary(new {area = ""});
+
+ var surfaceController = SurfaceControllerResolver.Current.RegisteredSurfaceControllers
+ .SingleOrDefault(x => x == surfaceType);
+ if (surfaceController == null)
+ throw new InvalidOperationException("Could not find the surface controller of type " + surfaceType.FullName);
+ var metaData = PluginController.GetMetadata(surfaceController);
+ if (!metaData.AreaName.IsNullOrWhiteSpace())
+ {
+ //set the area to the plugin area
+ routeVals.Add("area", metaData.AreaName);
+ }
+
+ return htmlHelper.Action(actionName, metaData.ControllerName, routeVals);
+ }
+
#region BeginUmbracoForm
///
@@ -307,7 +350,7 @@ namespace Umbraco.Web
Mandate.ParameterNotNullOrEmpty(action, "action");
Mandate.ParameterNotNull(surfaceType, "surfaceType");
- var area = Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea;
+ var area = "";
var surfaceController = SurfaceControllerResolver.Current.RegisteredSurfaceControllers
.SingleOrDefault(x => x == surfaceType);
@@ -366,7 +409,6 @@ namespace Umbraco.Web
object additionalRouteVals,
IDictionary htmlAttributes)
{
- Mandate.ParameterNotNullOrEmpty(area, "area");
Mandate.ParameterNotNullOrEmpty(action, "action");
Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName");
diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
index c1df3fb48e..bba31be513 100644
--- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
+++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs
@@ -176,8 +176,6 @@ namespace Umbraco.Web.Mvc
/// The original route definition that would normally be used to route if it were not a POST
private IHttpHandler HandlePostedValues(RequestContext requestContext, PostedDataProxyInfo postedInfo, RouteDefinition routeDefinition)
{
- var standardArea = Umbraco.Core.Configuration.GlobalSettings.UmbracoMvcArea;
-
//set the standard route values/tokens
requestContext.RouteData.Values["controller"] = postedInfo.ControllerName;
requestContext.RouteData.Values["action"] = postedInfo.ActionName;
@@ -185,7 +183,7 @@ namespace Umbraco.Web.Mvc
IHttpHandler handler = new MvcHandler(requestContext);
//ensure the controllerType is set if found, meaning it is a plugin, not locally declared
- if (!postedInfo.Area.InvariantEquals(standardArea))
+ if (!postedInfo.Area.IsNullOrWhiteSpace())
{
//requestContext.RouteData.Values["controllerType"] = postedInfo.ControllerType;
//find the other data tokens for this route and merge... things like Namespace will be included here