Knowledgebase

Home > Item #109

Header error occurs when I uncomment some debug lines that write values to the screen

Item: #109
Date: 5 Jan 2002
Applies to
v4
v5

Question

I am getting the following error when trying to test entering an order.

Response object error 'ASP 0156 : 80004005'

Header Error

/mysitename/asp/mailorder.asp, line 250

The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.


I have Un-Remmed the following lines in functions.asp (as instructed) to try to help in the debugging.

Response.Write(QueryText)
On Error Resume Next


I have read on Microsoft's Site about this error, and it says it is related to headers being written again - its says to put the following syntax in the ASP:

<% Response.Buffer = True %>

Is this what I should do, and if so, where should I do it?

BTW - I get the same error on the about.asp when I have the shop "closed."

Answer

A header error is caused when a command such as response.cookies or response.redirect (both of which modify the page header) is used after a response.write, or after normal HTML page content has been written to the page.

In the case about, the lines that are uncommented cause debug data to be written to the page, but because this page then tries to write cookies later down the page, it causes an error.

If the uncommented lines have the ' added in front of them again, the header error will disappear.

If you do wish to use the buffer statement, this should go at the top of the page, just under the vbscript language tag.

Can't find the answer you need? Click here to open a support ticket.

« Back