diff --git a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs
index bf3586a174..b4171add35 100644
--- a/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs
+++ b/src/Umbraco.Web/Macros/PartialViewMacroEngine.cs
@@ -140,12 +140,11 @@ namespace Umbraco.Web.Macros
string output;
using (var controller = new PartialViewMacroController(macro, content))
{
- //bubble up the model state from the main view context to our custom controller.
- //when merging we'll create a new dictionary, otherwise you might run into an enumeration error
- // caused from ModelStateDictionary
- controller.ModelState.Merge(new ModelStateDictionary(viewContext.ViewData.ModelState));
+ controller.ViewData = viewContext.ViewData;
+
controller.ControllerContext = new ControllerContext(request, controller);
- //call the action to render
+
+ //call the action to render
var result = controller.Index();
output = controller.RenderViewResultAsString(result);
}
diff --git a/src/Umbraco.Web/Mvc/ControllerExtensions.cs b/src/Umbraco.Web/Mvc/ControllerExtensions.cs
index f63cae1dcb..c15520b57c 100644
--- a/src/Umbraco.Web/Mvc/ControllerExtensions.cs
+++ b/src/Umbraco.Web/Mvc/ControllerExtensions.cs
@@ -130,26 +130,13 @@ namespace Umbraco.Web.Mvc
///
/// Normally in MVC the way that the View object gets assigned to the result is to Execute the ViewResult, this however
/// will write to the Response output stream which isn't what we want. Instead, this method will use the same logic inside
- /// of MVC to assign the View object to the result but without executing it. This also ensures that the ViewData and the TempData
- /// is assigned from the controller.
+ /// of MVC to assign the View object to the result but without executing it.
/// This is only relavent for view results of PartialViewResult or ViewResult.
///
///
///
- internal static void EnsureViewObjectDataOnResult(this ControllerBase controller, ViewResultBase result)
- {
- result.TempData = controller.TempData;
-
- var newViewDataDict = new ViewDataDictionary(controller.ViewData);
- var viewDataDictionary = result.ViewData;
- foreach (var d in newViewDataDict)
- viewDataDictionary[d.Key] = d.Value;
-
- result.ViewData = viewDataDictionary;
-
- foreach (var keyValuePair in controller.ViewData.ModelState.Keys)
- result.ViewData[keyValuePair] = keyValuePair;
-
+ private static void EnsureViewObjectDataOnResult(this ControllerBase controller, ViewResultBase result)
+ {
if (result.View != null) return;
if (string.IsNullOrEmpty(result.ViewName))