From 480f73dba743fe4fde8322289ee51e110514c111 Mon Sep 17 00:00:00 2001 From: Casey Neehouse Date: Sun, 19 Aug 2012 09:26:13 +0400 Subject: [PATCH] Corrections to RenderTemlate(pageId) method to reset context and remove altTemplate from the rendering page. --- src/Umbraco.Web/umbraco.presentation/library.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index c678073c64..a082213a6e 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -1233,10 +1233,10 @@ namespace umbraco { if (UmbracoSettings.UseAspNetMasterPages) { - System.Collections.Generic.Dictionary items = getCurrentContextItems(); - if (!umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled) { + System.Collections.Generic.Dictionary items = getCurrentContextItems(); + HttpContext Context = HttpContext.Current; StringBuilder queryString = new StringBuilder(); const string ONE_QS_PARAM = "&{0}={1}"; @@ -1256,6 +1256,7 @@ namespace umbraco updateLocalContextItems(items, Context); return sw.ToString(); + } else { @@ -1315,12 +1316,14 @@ namespace umbraco { if (!umbraco.presentation.UmbracoContext.Current.LiveEditingContext.Enabled) { + System.Collections.Generic.Dictionary items = getCurrentContextItems(); + HttpContext Context = HttpContext.Current; StringBuilder queryString = new StringBuilder(); const string ONE_QS_PARAM = "&{0}={1}"; foreach (object key in Context.Request.QueryString.Keys) { - if (!key.ToString().ToLower().Equals("umbpageid")) + if (!key.ToString().ToLower().Equals("umbpageid") && !key.ToString().ToLower().Equals("alttemplate")) queryString.Append(string.Format(ONE_QS_PARAM, key, Context.Request.QueryString[key.ToString()])); } StringWriter sw = new StringWriter(); @@ -1328,6 +1331,9 @@ namespace umbraco Context.Server.Execute( string.Format("/default.aspx?umbPageID={0}{1}", PageId, queryString), sw); + + // update the local page items again + updateLocalContextItems(items, Context); return sw.ToString(); }