From 7d1e9cfd7203a44f779e1df140b7609beee3aede Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Tue, 19 Feb 2013 06:11:17 +0600 Subject: [PATCH] Fixes: #U4-1727 --- src/Umbraco.Web/Mvc/RenderRouteHandler.cs | 14 +++++++------- src/Umbraco.Web/WebBootManager.cs | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs index 0f9c5d87d0..9bfbc0b123 100644 --- a/src/Umbraco.Web/Mvc/RenderRouteHandler.cs +++ b/src/Umbraco.Web/Mvc/RenderRouteHandler.cs @@ -181,12 +181,11 @@ namespace Umbraco.Web.Mvc //set the standard route values/tokens requestContext.RouteData.Values["controller"] = postedInfo.ControllerName; requestContext.RouteData.Values["action"] = postedInfo.ActionName; - requestContext.RouteData.DataTokens["area"] = postedInfo.Area; IHttpHandler handler = new MvcHandler(requestContext); //ensure the controllerType is set if found, meaning it is a plugin, not locally declared - if (postedInfo.Area != standardArea) + if (!postedInfo.Area.InvariantEquals(standardArea)) { //requestContext.RouteData.Values["controllerType"] = postedInfo.ControllerType; //find the other data tokens for this route and merge... things like Namespace will be included here @@ -195,12 +194,15 @@ namespace Umbraco.Web.Mvc var surfaceRoute = RouteTable.Routes.OfType() .SingleOrDefault(x => x.Defaults != null && x.Defaults.ContainsKey("controller") && - x.Defaults["controller"].ToString() == postedInfo.ControllerName && + x.Defaults["controller"].ToString().InvariantEquals(postedInfo.ControllerName) && x.DataTokens.ContainsKey("area") && - x.DataTokens["area"].ToString() == postedInfo.Area); + x.DataTokens["area"].ToString().InvariantEquals(postedInfo.Area)); if (surfaceRoute == null) throw new InvalidOperationException("Could not find a Surface controller route in the RouteTable for controller name " + postedInfo.ControllerName + " and within the area of " + postedInfo.Area); - //set the 'Namespaces' token so the controller factory knows where to look to construct it + + requestContext.RouteData.DataTokens["area"] = surfaceRoute.DataTokens["area"]; + + //set the 'Namespaces' token so the controller factory knows where to look to construct it if (surfaceRoute.DataTokens.ContainsKey("Namespaces")) { requestContext.RouteData.DataTokens["Namespaces"] = surfaceRoute.DataTokens["Namespaces"]; @@ -210,8 +212,6 @@ namespace Umbraco.Web.Mvc } - //store the original URL this came in on - requestContext.RouteData.DataTokens["umbraco-item-url"] = requestContext.HttpContext.Request.Url.AbsolutePath; //store the original route definition requestContext.RouteData.DataTokens["umbraco-route-def"] = routeDefinition; diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index 3018d5cd23..9a13b802e5 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -127,7 +127,7 @@ namespace Umbraco.Web //Create the REST/web/script service routes var webServiceRoutes = RouteTable.Routes.MapRoute( "Umbraco_web_services", - "Umbraco/RestServices/{controller}/{action}/{id}", + umbracoPath + "/RestServices/{controller}/{action}/{id}", new {controller = "SaveFileController", action = "Index", id = UrlParameter.Optional}, //VERY IMPORTANT! for this route, only match controllers in this namespace! new string[] { "Umbraco.Web.WebServices" }