views:

151

answers:

1

I am getting the following warnings on the Event Log for a 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 the WebSite but it just does not show in debugger. The web page which has got this issue contains the following.

  1. Its a content page with a Master page.
  2. It has a grid inside an UpdatePanel which is Triggered by a Timer.
  3. On the specified time grid data is refreshed.

Everytime this happens we see a new warning in the EventLog. What is the best way to go about this issue?

+1  A: 

You have a control that is misbehaving. You may add headers at any point before any content is written to the response stream, after that point adding a header will throw.

The exception is being thrown deep so you will have to try Debug>Exceptions>Common Language Runtime Exeptions and check 'thrown'. It may now be possible to break on the exeption and examine the inner exception or trace the call stack and find out who is being bad.

Sky Sanders
I did that but it does not break. Only in the event log it shows the error.
Amitabh
@Amitabh - ok, Tools>Options>Debugging> check 'enable .net source stepping' and maybe you can break.
Sky Sanders