private RouteData GetRouteData(RequestContext requestContext, ContentItem item, string controllerName) { var data = new RouteData(); data.Values[ContentRoute.ControllerKey] = controllerName; data.Values[ContentRoute.ActionKey] = "Index"; data.Values[ContentRoute.ContentItemKey] = item.ID; // retrieve the virtual path so we can figure out if this item is routed through an area var vpd = routes.GetVirtualPath(requestContext, data.Values); if (vpd == null) throw new InvalidOperationException("Unable to render " + item + " (" + data.Values.ToQueryString() + " did not match any route)"); data.Values["area"] = vpd.DataTokens["area"]; data.Route = vpd.Route; data.ApplyCurrentPath(new PathData(item.ClosestPage(), item)); return data; }