| ASP Error - The HTTP Headers are already written |
|
|
|
| Written by Chetankumar Akarte | |
| Tuesday, 05 June 2007 | |
ASP Error - The HTTP Headers are already writtenWhile redirecting from a page in asp we get a very common error: The HTTP headers are already written to the client browser.
Response object error 'ASP 0156 : 80004005 The Redirect method of the Response object operates by sending the 302 Object Moved response header, plus the new location of the file, to the client. When it receives this response, the user’s browser automatically requests the new page. Because redirection depends on HTTP headers, which come at the beginning of the document, We can’t redirect once text has been sent to the client. If we redirect in a server-side script after data has been sent to the client, the above error occurs: As you don’t know at the beginning of the page whether you need to redirect, you have to use the buffering capabilities of the Response object. If Response.Buffer is True, HTML output is collected in a buffer and sent all at once to the client. If at some point we need to redirect to another page, ASP automatically discards any existing output in the buffer when we call Response.Redirect. We may also use Response.Clear at any time to clear the buffer and start again. So you can now easily avoid the error - The HTTP Headers are already written submit your Article, Tutorials or FAQsHello... if you are interested to submit your Article, Tutorials or FAQs on TechXcel.com - provides technical excellence... mail us at This e-mail address is being protected from spam bots, you need JavaScript enabled to view it Comments (0)
![]() Write comment
You must be logged in to a comment. Please register if you do not have an account yet.
Copyright 2007. All Rights Reserved. |