logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
Painting
Heart Disease
Horror Literature
Dating
Hiking & Backpacking
SF/Fantasy Books
Healthy Foods


dailyclick
All times in EST

Clairvoyance: 08:00 PM

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

ASP Error - The HTTP Headers are already written

Guest Author - Lisa Shea

A very common error in the world of ASP is: The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content. The actual error block tends to look like this:

Response object error 'ASP 0156 : 80004005
Header Error
/index.asp, line 22
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.

First, what causes this error? It is exactly what is being said. You have already written HTTP headers - such as the HTML or HEAD or BODY commands. You are now trying to do something else - probably the response.redirect command. You can't go off to a new page in the middle of writing an old page.

The first most likely situation is that you really did write something out and then try to response.redirect. If you want to go to a new page, do your decision process BEFORE you start writing anything to the screen. You can't just leap half way through drawing a page. Do your processing, decide if you need to go elsewhere, and go there if you have to. If not, draw the page you are on currently. You can learn more about Using Response.Redirect to Change Pages

The second most common reason for this happening is that you were fooling with the buttons in IIS. If you go into Home Directory - Configuration - App Options, there is a checkbox called "Enable Buffering". This by default should be ON. When this is on, it means your ASP process stores up what it is working on until it reaches the end, and then sends the full page off to the user. It's the efficient way of handling ASP.

However, if you turn that checkbox OFF, you cannot just call a response.redirect command to leap to a new page. You have to start manually dealing with buffering issues. If you really want to get into this mess, be sure to read up on How Buffering Works in ASP.

The simple solution is:

* Always leave the Enable Buffering checkbox to ON
* Always use response.redirect BEFORE you write out ANY HTML.

Introduction to ASP Ebook

Download this ebook to get everything you need to know about learning ASP - from a step by step tutorial to function lists, sample code, common errors and solutions, and much more! 101 pages.
This site needs an editor - click to learn more!

Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Twitter Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Facebook Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to MySpace Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Del.icio.us Digg ASP+Error+%2D+The+HTTP+Headers+are+already+written Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Yahoo My Web Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Google Bookmarks Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Stumbleupon Add ASP+Error+%2D+The+HTTP+Headers+are+already+written to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2013 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2013 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor