diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index 49e49b592f..3fa50ded67 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -354,6 +354,9 @@ namespace umbraco } catch (Exception e) { + LogHelper.WarnWithException( + "Error loading partial view macro (View: " + Model.ScriptName + ")", true, e); + renderFailed = true; Exceptions.Add(e); macroControl = handleError(e); @@ -1824,6 +1827,12 @@ namespace umbraco public static string MacroContentByHttp(int PageID, Guid PageVersion, Hashtable attributes) { + + if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted) + { + return "Cannot render macro content in the rich text editor when the application is running in a Partial Trust environment"; + } + string tempAlias = (attributes["macroalias"] != null) ? attributes["macroalias"].ToString() : attributes["macroAlias"].ToString(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs index 7d614795bc..8ea7dcddbb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/nodeFactory/Node.cs @@ -550,7 +550,13 @@ namespace umbraco.NodeFactory { if (HttpContext.Current.Items["pageID"] == null) throw new InvalidOperationException("There is no current node."); - return (int)HttpContext.Current.Items["pageID"]; + + var intAttempt = HttpContext.Current.Items["pageID"].TryConvertTo(); + if (intAttempt == false) + { + throw new InvalidOperationException("The pageID value in the HttpContext.Items cannot be converted to an integer"); + } + return intAttempt.Result; } } } \ No newline at end of file