diff --git a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs index 6eec7fbe1b..d61257b760 100644 --- a/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs +++ b/src/Umbraco.Web/Mvc/AreaRegistrationExtensions.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Configuration; namespace Umbraco.Web.Mvc { - internal static class AreaRegistrationExtensions + internal static class AreaRegistrationExtensions { /// /// Creates a custom individual route for the specified controller plugin. Individual routes @@ -31,7 +31,7 @@ namespace Umbraco.Web.Mvc string umbracoTokenValue = "backoffice") { Mandate.ParameterNotNullOrEmpty(controllerName, "controllerName"); - Mandate.ParameterNotNullOrEmpty(controllerSuffixName, "controllerSuffixName"); + Mandate.ParameterNotNull(controllerSuffixName, "controllerSuffixName"); Mandate.ParameterNotNullOrEmpty(defaultAction, "defaultAction"); Mandate.ParameterNotNull(controllerType, "controllerType"); Mandate.ParameterNotNull(routes, "routes"); @@ -63,13 +63,15 @@ namespace Umbraco.Web.Mvc //Don't look anywhere else except this namespace! controllerPluginRoute.DataTokens.Add("UseNamespaceFallback", false); - //constraints: only match controllers ending with 'controllerSuffixName' and only match this controller's ID for this route - controllerPluginRoute.Constraints = new RouteValueDictionary( - new Dictionary + //constraints: only match controllers ending with 'controllerSuffixName' and only match this controller's ID for this route + if (controllerSuffixName.IsNullOrWhiteSpace() == false) + { + controllerPluginRoute.Constraints = new RouteValueDictionary( + new Dictionary { { "controller", @"(\w+)" + controllerSuffixName } - }); - + }); + } //match this area controllerPluginRoute.DataTokens.Add("area", area.AreaName); diff --git a/src/Umbraco.Web/Mvc/PluginControllerArea.cs b/src/Umbraco.Web/Mvc/PluginControllerArea.cs index 591d53480a..a8b6725534 100644 --- a/src/Umbraco.Web/Mvc/PluginControllerArea.cs +++ b/src/Umbraco.Web/Mvc/PluginControllerArea.cs @@ -67,7 +67,7 @@ namespace Umbraco.Web.Mvc { foreach (var s in surfaceControllers) { - this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "Surface", "Index", UrlParameter.Optional, "surface"); + this.RouteControllerPlugin(s.ControllerName, s.ControllerType, routes, "", "Index", UrlParameter.Optional, "surface"); } } }