Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Trevor Buchanan 1 post 21 karma points
    Mar 19, 2015 @ 00:56
    Trevor Buchanan
    0

    Error logged when redirecting response in FormBase.Submit

    I have a simple FormBase implementation that calls HttpContext.Current.Response.Redirect([a url]) in its Submit method.  The form redirects correctly, but I'm seeing an HttpException warning in the umbraco log each time I submit it; here's the stacktrace:

    2015-03-18 16:41:02,615 [19] WARN umbraco.macro - [Thread 17] 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 umbraco.BusinessLogic.StateHelper.SetCookieValue(String key, String value, Double daysToPersist) at Umbraco.Forms.Core.Services.RecordService.PersistRecord() at Umbraco.Forms.Core.Services.RecordService.Approve() at Umbraco.Forms.Core.Services.RecordService.Submit() at Umbraco.Forms.Mvc.BusinessLogic.FormRecordSaver.HandleContourFormSubmitWithoutRSStorage(Guid FormId, String recordId, Int32 formStep, Int32 currentPageId, ControllerContext context, Boolean previousClicked, Boolean storeRecord) at Umbraco.Forms.Mvc.Controllers.FormRenderController.ContourForm(FormViewModel model, Boolean captchaIsValid) at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass13.b__10() at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) 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) at ASP._Page_macroScripts_MvcRenderContourForm_cshtml.Execute() in d:\WebFiles\UmbracoStage\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)

    It's difficult to troubleshoot this without source code (problem with an async call maybe?), but perhaps the issue is obvious and I'm just missing it. Is there a better way to do a simple redirect to a dynamically-determined url?

    I'm using Umbraco 6.2.5 and Contour 3.0.25

  • Valentine M... 4 posts 73 karma points
    Oct 12, 2017 @ 14:21
    Valentine M...
    0

    I have same issue with Umbraco 7.5.11.

    I have partial view on master page with post form and AntiForgeryToken.

    Each time Umbraco redirects for example from old url to new url HttpExceptions throws inside of AntiForgeryToken "Server cannot modify cookies after HTTP headers have been sent."

    OR

    "Server cannot append header after HTTP headers have been sent"

    I'm new in Umbraco, any ideas/solutions?

    Best Regards

Please Sign in or register to post replies

Write your reply to:

Draft