Header error

Results 1 to 3 of 3

Thread: Header error

  1. #1
    Mark Guest

    Default Header error

    I get the following error when processing a form page. I&#039m trying to do a response.redirect to a secondary page. "The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content." Is there a way to clear the previously written headers prior to a redirect?

  2. #2
    Kevin Guest

    Default RE: Header error

    No, if a Response.Redirect is going to execute, then you have to make sure you don&#039t write anything to the output buffer. Not even an <html> tag. You can read and write to a database or text file, but you can&#039t set cookies. In ASP 3.0 they have Response.Transfer which acts differently and you may be able to do some of those things.

  3. #3
    BarnyMiler Guest

    Default RE: Header error

    If you are unsure if the page you are writing will be redirected or not, you could enable &#039Buffering&#039 in IIS for the site and simply set the Buffer property of the Response object to True, like this<BR><BR>&#039Enable Buffering, in case we need to redirect.<BR>Response.Buffer = True<BR><BR>Then, you can write all you want to the client, but nothing will actually be sent until you call the End() method of the Response Object, telling it to stop buffering and send everything to the client, like this:<BR><BR>&#039We are done processing<BR>Response.End<BR><BR>-or-<BR><BR>&#039We are done processing and need to redirect<BR>Response.Clear<BR><BR>&#039Now redirect<BR>Response.Redirect "nextpage.asp"<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts