Response.redirect - The HTTP headers are already written to the client browser
Posted on 2010-08-24
Have a script which sends muiltiple emails to a number of email addresses in a loop depending on the number of clients.
Sometimes this can be 1000 or more and would time out.
Once complete at the end of the page I do a response.redirect to a page to show it is completed.
I was recommended to add the following to prevent the time out.
At the top of page:
Response.Buffer = True
At the last line of the loop
But after doing this my response.redirect no longer works giving the error:
Response object error 'ASP 0156 : 80004005'
/send/sendmessage/index.asp, line 125
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
How can I fix this?
Never really used the .buffer or .flush before.