Error loading MacroEngine script (file: MvcRenderContourForm.cshtml,
Type: ''. Exception: System.Web.HttpException (0x80004005): Server
cannot modify cookies after HTTP headers have been sent.
at System.Web.HttpCookieCollection.Set(HttpCookie cookie)
at
System.Web.Helpers.AntiXsrf.AntiForgeryWorker.GetFormInputElement(HttpContextBase
httpContext)
at System.Web.Helpers.AntiForgery.GetHtml()
at System.Web.Mvc.HtmlHelper.AntiForgeryToken()
at
ASP._Page_umbraco_plugins_umbracoContour_Views_Form_cshtml.Execute() in \umbraco\Plugins\umbracoContour\Views\Form.cshtml:line
50
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage)
at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext
viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext
context)
at
System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter
filter, ResultExecutingContext preContext, Func`1 continuation)
at
System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext
controllerContext, IList`1 filters, ActionResult actionResult)
at
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext
controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext
requestContext)
at
Umbraco.Forms.Mvc.Bridge.Html.MvcBridgeExtensions.RenderMvcAction(HtmlHelper
helper, String action, String controller, String formId, String
antiForgeryToken, Object node, Object parameter) in \TeamCity\buildAgent\work\fd622d7f786e1305\Umbraco.Forms.Mvc\Bridge\Html\MvcBridgeExtensions.cs:line
84
at ASP._Page_macroScripts_MvcRenderContourForm_cshtml.Execute() in \macroScripts\MvcRenderContourForm.cshtml:line
9
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.WebPages.WebPage.ExecutePageHierarchy()
at
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext
pageContext, TextWriter writer, WebPageRenderingBase startPage)
at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel
macro, INode currentPage)
at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro,
INode currentPage)
at umbraco.macro.loadMacroScript(MacroModel macro)
at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
Could you tell us more about the issue? Like what version of Umbraco are you using? What version of COntour/Forms are you using? When does this happen?
What is your proces going from local to production? Seems like you're using TeamCity? Could you perhaps be missing some files? or could it be that some id's exists locally and not in production if you rely on hardcoded id's for some reason?
I also have this issue (not with contour but with UmbracoForms)! I am only getting the error in my logs but it is happening a lot! and only on the production environment.
After a little googling I saw that someone else thought it could be an issue with the AntiForgeryToken and crawlers? But they couldn't confirm this. http://orchard.codeplex.com/workitem/20847
public class EmailSignupController : SurfaceController
{
[ValidateAntiForgeryToken]
[HttpPost]
public ActionResult Submit(EmailSignupViewModel model)
{
if (!ModelState.IsValid)
{
return
Json(
new {
Success = false,
Message = "There was an error submitting the form, please try again later."
}
);
}
// add email address to database
DbService dbService = new DbService();
dbService.InsertEmailSubscription(model.EmailAddress);
return Json(new { Success = true });
}
}
And my stacktrace:-
System.Web.HttpException (0x80004005): Server cannot modify cookies after HTTP headers have been sent.
at System.Web.HttpCookieCollection.Set(HttpCookie cookie)
at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.GetFormInputElement(HttpContextBase httpContext)
at System.Web.Mvc.HtmlHelper.AntiForgeryToken()
at ASP._Page_Views_Partials_SubscribeForm_cshtml.Execute() in \\172.22.19.156\content1\svc002\Views\Partials\SubscribeForm.cshtml:line 5
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at ASP._Page_Views_Partials_Subscribe_cshtml.Execute() in \\172.22.19.156\content1\svc002\Views\Partials\Subscribe.cshtml:line 5
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at ASP._Page_Views_Partials_PageHead_cshtml.Execute() in \\172.22.19.156\content1\svc002\Views\Partials\PageHead.cshtml:line 27
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
at ASP._Page_Views_Master_cshtml.Execute() in \\172.22.19.156\content1\svc002\Views\Master.cshtml:line 50
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
at System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
at System.Web.WebPages.WebPageBase.Write(HelperResult result)
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)
at System.Web.WebPages.WebPageBase.PopContext()
at System.Web.WebPages.WebPageBase.Write(HelperResult result)
at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)
at System.Web.WebPages.WebPageBase.PopContext()
at StackExchange.Profiling.MVCHelpers.WrappedView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__19()
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Error loading MacroEngine script
I've noticed a lot of errors
Error loading MacroEngine script (file: MvcRenderContourForm.cshtml, Type: ''. Exception: System.Web.HttpException (0x80004005): Server cannot modify cookies after HTTP headers have been sent. at System.Web.HttpCookieCollection.Set(HttpCookie cookie) at System.Web.Helpers.AntiXsrf.AntiForgeryWorker.GetFormInputElement(HttpContextBase httpContext) at System.Web.Helpers.AntiForgery.GetHtml() at System.Web.Mvc.HtmlHelper.AntiForgeryToken() at ASP._Page_umbraco_plugins_umbracoContour_Views_Form_cshtml.Execute() in \umbraco\Plugins\umbracoContour\Views\Form.cshtml:line 50 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at Umbraco.Core.Profiling.ProfilingView.Render(ViewContext viewContext, TextWriter writer) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at Umbraco.Forms.Mvc.Bridge.Html.MvcBridgeExtensions.RenderMvcAction(HtmlHelper helper, String action, String controller, String formId, String antiForgeryToken, Object node, Object parameter) in \TeamCity\buildAgent\work\fd622d7f786e1305\Umbraco.Forms.Mvc\Bridge\Html\MvcBridgeExtensions.cs:line 84 at ASP._Page_macroScripts_MvcRenderContourForm_cshtml.Execute() in \macroScripts\MvcRenderContourForm.cshtml:line 9 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at umbraco.MacroEngines.RazorMacroEngine.ExecuteRazor(MacroModel macro, INode currentPage) at umbraco.MacroEngines.RazorMacroEngine.Execute(MacroModel macro, INode currentPage) at umbraco.macro.loadMacroScript(MacroModel macro) at umbraco.macro.renderMacro(Hashtable pageElements, Int32 pageId)
Hi Michael
Could you tell us more about the issue? Like what version of Umbraco are you using? What version of COntour/Forms are you using? When does this happen?
Cheers, Jan
Hi Jan,
Umbraco version 7.1.4
Contour version 3.0.24-Build.31
It happen sometimes, I can't reproduce this bug locally.
Thanks,
Michael
Hi Michael
What is your proces going from local to production? Seems like you're using TeamCity? Could you perhaps be missing some files? or could it be that some id's exists locally and not in production if you rely on hardcoded id's for some reason?
/Jan
Hi Michael,
I also have this issue (not with contour but with UmbracoForms)! I am only getting the error in my logs but it is happening a lot! and only on the production environment.
After a little googling I saw that someone else thought it could be an issue with the AntiForgeryToken and crawlers? But they couldn't confirm this. http://orchard.codeplex.com/workitem/20847
I have not been able to reproduce locally either.
I am using Umbraco v6.1.6.
My view is as follows:-
My controller:-
And my stacktrace:-
Hi All,
I have this problemon both (local, prod)
But this problem occurs sometimes, and if this error happen form just reload page and no workflow was executed.
Thanks
anyone found a solution on this ?
is working on a reply...