Skip to content

TechXcel.com - provides technical excellence...

Narrow screen resolution Wide screen resolution Increase font size Decrease font size Default font size default color orange color green color
You are here: Home arrow Tech FAQ arrow ASP arrow ASP Error - The HTTP Headers are already written
ASP Error - The HTTP Headers are already written PDF Print E-mail
(1 vote)
Written by Chetankumar Akarte   
Tuesday, 05 June 2007

ASP Error - The HTTP Headers are already written

While 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
Header Error
/test.asp, line 135
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

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 FAQs

Hello... 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)Add Comment

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.
busy




Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Spurl!Wists!Simpy!Newsvine!Blinklist!Furl!Fark!Blogmarks!Yahoo!Smarking!Netvouz!Shadows!
RawSugar!Ma.gnolia!PlugIM!Squidoo!BlogMemes!FeedMeLinks!BlinkBits!Tailrank!linkaGoGo!
 

Who's Online

We have 1 guest online

User Login

PayPal Donation

Enter Amount:

Syndicate

TechXcel's Friends

Tutorials Garden
Wicolorz
pixel2life

Text Link Add

Statistics

Members: 262
News: 60
Web Links: 6
Visitors: 269781

Google Seach

Google AdSense

TechXcel Referrals

TechXcel's Sponcer...