Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Response.Redirect problems


Message #1 by "Tony Dawes" <sysadmin@c...> on Tue, 6 Mar 2001 21:59:32
Tony, please post ASP questions to one of the ASP groups next time.

Response.Redirect adds the HTTP headers to client that informs the client
that it should display a different URL (page). These headers are sent to the
client
before any HTML is sent. So once you start sending HTML to the client it is
too late
to modify the HTTP headers.

You must be sending something to the client before you call
Response.Redirect (either with
Response.Write or text that is not inside the <% %> code area). If you can
not avoid this
set the Response.Buffer = TRUE for this page (to be honest, it's a pretty
good setting for all
ASP pages). This will hold all the content that is to be sent to the client
in a buffer until your ASP
has finished (or Response.Flush has been called). By doing this the HTTP
headers can be
changed at any time, so you can call Response.Redirect whenever you want.


Cheers,
Anil

----- Original Message -----
From: "Tony Dawes" <sysadmin@c...>
To: "javascript" <javascript@p...>
Sent: Tuesday, March 06, 2001 9:59 PM
Subject: [javascript] Response.Redirect problems


> Hi,
>
> I am trying to use Response.Redirect("whereever.htm"), but when I do, I
get the following
> error:
>
> Response object error 'ASP 0156 : 80004005'
>
> Header Error
>
> /asp/test.asp, line 12
>
> The HTTP headers are already written to the client browser. Any HTTP
header modifications
> must be made before writing page content.
>
>
> Can anyone help??
> Thanks in advance..
>
> Tony Dawes.


  Return to Index