Problem

When you view an Active Server Pages (ASP) page in a browser, the following error can occur:

Response object error ‘ASP 0156 : 80004005’
Header Error

/example/example.asp, line 99

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

Cause

According toMicrosoft, This error occurs because the Web server uses an HTTP header to set the client browser. The Web server then tries to reset the client brower by using another HTTP header (for example, when an HTTP header sets the browser to content-type=text/html and then a redirection is issued after this). An example of this is when an ASP page is processed that contains HTML tags or any other server-side scripts before a Response.Redirect statement.

Resolution

  1. To resolve this problem, set the HTTP Headers, such as Redirect statements or cookie information, before you send HTML output.
  2. Or, enable buffering.

    How to enable buffering

    To set buffering on a page level, add code after the @LANGUAGE line on an ASP page as shown below:

    <%@ Language=VBScript %>
    <%
    Response.Buffer = True
    %>
    

    External links