Server can't add header after sending HTTP headers?
I am getting the following warnings in the event log for an Asp.Net website running on IIS 7.
Exception information:
Exception type: HttpException
Exception message: Server cannot append header after HTTP headers have been sent.
at System.Web.Hosting.ISAPIWorkerRequest.SendUnknownResponseHeader(String name, String value)
at System.Web.HttpResponse.WriteHeaders()
at System.Web.HttpResponse.Flush(Boolean finalFlush)
at System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e)
I tried to debug WebSite but it just doesn't show up in the debugger. The web page with this issue contains the following.
- Content page with master page.
- It has a grid inside the UpdatePanel that is triggered by a timer.
- At the specified time, the grid data is updated.
Every time this happens, we see a new warning in the EventLog. What is the best way to solve this problem?
a source to share
You have a control that misbehaves. You can add headers at any time before any content is written to the response stream, after a header adding the header has been added.
The exception is being thrown deep, so you'll have to try Debug> Exceptions> Common Language Runtime Exceptions and check for "throw". It may now be possible to break the exeption and examine the inner exception, or trace the call stack and figure out who is bad.
a source to share