locked
Server cannot append header after HTTP headers have been sent. RRS feed

  • Question

  • User24748943 posted

    hi.

    i have a web forms app (deployed to azure) that was created using vs 2013 update 2. i have also injected elmah into the app. now it seems something is wrong with the way authentification works: _sometimes_ i get the following exception notification from elmah:

    System.Web.HttpException: Server cannot append header
    after HTTP headers have been sent

    System.Web.HttpException (0x80004005): Server cannot append header after HTTP headers have been sent.
       at System.Web.HttpHeaderCollection.SetHeader(String name, String value, Boolean replace)
       at System.Web.HttpHeaderCollection.Set(String name, String value)
       at Microsoft.Owin.Host.SystemWeb.CallHeaders.AspNetResponseHeaders.Set(String key, String[] values)
       at Microsoft.Owin.Host.SystemWeb.CallHeaders.AspNetResponseHeaders.set_Item(String key, String[] value)
       at Microsoft.Owin.Infrastructure.OwinHelpers.SetHeaderUnmodified(IDictionary`2 headers, String key, String[] values)
       at Microsoft.Owin.Infrastructure.OwinHelpers.AppendHeaderUnmodified(IDictionary`2 headers, String key, String[] values)
       at Microsoft.Owin.HeaderDictionary.AppendValues(String key, String[] values)
       at Microsoft.Owin.ResponseCookieCollection.Append(String key, String value, CookieOptions options)
       at Microsoft.Owin.Security.Cookies.CookieAuthenticationHandler.<ApplyResponseGrantAsync>d__b.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<ApplyResponseCoreAsync>d__8.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<TeardownAsync>d__5.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware`1.<Invoke>d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at Microsoft.AspNet.Identity.Owin.IdentityFactoryMiddleware`2.<Invoke>d__0.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
       at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
       at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
       at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)




    I _think_ this happens when i'm logged into the site (into a protected directory, auth with forms), and close the browser or move to a different site.
    any ideas what would be causing this or what to do to get rid of this?

    WM_THX

    -thomas woelfer

    Wednesday, June 11, 2014 9:18 AM

Answers

All replies

  • User-734925760 posted

    Hi,

    According to your description and the error message, please refer to make sure the version of the DNN. So far as I know, this error will happen with some compresssion/whitespace filter settings in DNN 4.4.x,  this has been corrected in DNN 4.5.  So please refor to upgrade the version.

    Hope it's useful for you.

    Best Regards,

    Michelle Ge

    Thursday, June 12, 2014 3:01 AM
  • User24748943 posted

    Michelle,

    what is "DNN" ? My application is basically just the application that vs 2013 update 2 generated automatically for me with some minor changes... (plus elmah). Incase you refer the "DotNetNuke" - i'm not using this. As i said, this is just the barebones stuff vs generated...

    WM_THX
    -thomas woelfer

    Thursday, June 12, 2014 4:37 AM
  • User-1579698385 posted

    In case you haven't found the cause yet, I recently ran into this as well, and it appears to be due to an issue within Katana that should be fixed in a future release:

    http://katanaproject.codeplex.com/discussions/540202

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 4, 2014 12:42 PM