
problem with response.redirect
The problem is you're attempting to modify the headers after
the page has started to be transmitted to the client.
Once you break from the ASP script with the %> and start
doing things liks <HTML> then the server will start transmitting
data to the client.The first thing that gets transmitted is the headers.
When you do a response.redirect, this modifies the headers and
sends an HTTP 303 - Redirect to the client to go somewhere else.
Well, if you've already sent the headers (HTTP 200 - OK) how, then,
can you modify them?
Answer: You can't.
You must tell the server to wait until the whole page has been processed
before sending the client ANY information.
You can do this by setting Response.Buffer = True at the top of the page.
CAVEAT: remember, the entire page must be loaded before the client gets it,
this means that if you have a lengthy page or a time intensive page, the
client will have to sit there and wait for EVERYTHING to be processed
before they see anything appear on their site.
Be conservative using the Response.Buffer = True.
-Chad
Quote:
> problem with response.redirect
> i creat a web form (htm file) who submit to an ASP vbs page.
> this is my asp page code. here:
> <%
> dim erreur
> erreur=0
> if Request.Form ("titre_du_document")="" then erreur=1
> if Request.Form ("demandeur")="" then erreur=1
> if Request.Form ("telephone")="" then erreur=1
> if Request.Form ("PROVENANCE")="" then erreur=1
> if Request.Form ("unite_administrative")="" then erreur=1
> if Request.Form ("personne_ressource")="" then erreur=1
> if Request.Form ("delai_de_livraison")="" then erreur=1
> if Request.Form ("date")="" then erreur=1
> response.write erreur
> if erreur=1 then Response.Redirect("incorrect.htm")
> %>
> <HTML>
> <HEAD>
> </HEAD>
> <BODY>
> </BODY>
> </HTML>
> and then this error occur ==>
> Response object error 'ASP 0156 : 80004005'
> Header Error
> /communications/traduction/facteur.asp, line 23
> The HTTP headers are already written to the client browser. Any HTTP
> header modifications must be made before writing page content.
> can someone help ?
> Thank