|
-
Dec 7th, 2001, 02:03 PM
#1
Thread Starter
Addicted Member
Beginner help
I just started reading tutorials on ASP...can someone tell me what's wrong with the following code??
PHP Code:
<HTML>
<HEAD>
<Title>Example</title>
</HEAD>
<BODY>
<%
Response.Cookies("Colour") = "Red"
Dim Back
Back = Request.Cookies("Colour")
Response.Write("<font color=" + Back + ">Hello</font>")
%>
</BODY>
</HTML>
I get the following error:
Response object error 'ASP 0156 : 80004005'
Header Error
/MyWeb/Test.asp, line 8
The HTTP headers are already written to the client browser. Any HTTP header modifications must be made before writing page content.
Thanks.
-
Dec 7th, 2001, 02:43 PM
#2
Black Cat
You already started to write HTML. The HTTP headers must be written before you send the HTML data. Cookies are set via HTTP headers, so you must set them before you write any HTML.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Dec 8th, 2001, 02:22 AM
#3
PowerPoster
hi
I dont think anything is wrong with the code neither do we need to set the headers in ur case.
One guess would be that u r using a response.redirect in ur code down somewhere.
-
Dec 8th, 2001, 06:11 AM
#4
Thread Starter
Addicted Member
I had to put the code before the html....solved. Thanks
-
Dec 8th, 2001, 08:03 AM
#5
Fanatic Member
hey kikelinus, where did u get ur tutorials from ?? i have a couple but i dont find them to be explaining certain things the way i like or in easy enough detail.
secondly:
I had to put the code before the html....solved. Thanks
What do u mean? could u give me an example of how u fixed it pls ??
thanx.
-
Dec 8th, 2001, 12:10 PM
#6
Thread Starter
Addicted Member
Like this:
PHP Code:
<%
Response.Cookies("Colour") = "Red"
Dim Back
Back = Request.Cookies("Colour")
Response.Write("<font color=" + Back + ">Hello</font>")
%>
<HTML>
<HEAD>
<Title>Example</title>
</HEAD>
<BODY>
</BODY>
</HTML>
There is a good tutorial at www.planet-source-code.com, It is called "A practival guide to ASP".....
Also, the program ASPEdit (can be downloaded from download.com), comes with a database tutorial.
-
Dec 8th, 2001, 11:07 PM
#7
Fanatic Member
thanx a lot.
i owe u one man.
ME (Michael)
-
Dec 8th, 2001, 11:11 PM
#8
Fanatic Member
lol, ur link has a bug (just thought u would like to know)
u put a "period" after the .......com. here's the correct one:
http://www.planet-source-code.com
not trying to be mean
ME (Michael)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|