|
-
May 9th, 2001, 04:03 PM
#1
Thread Starter
Member
cookie not working - help needed!
I need help with the script below.
If the cookie is set, a message should say so. If not, a message will say so and then set the cookie and it's value.
for some reason this does NOT work:
Code:
<% Option Explicit
Response.Buffer = true
Dim expDate, aspPoll
aspPoll = "aspPoll"
expDate = "2001-05-09 21:42" ' for this version this is static, it will be dynamic in the near future
Response.write("------------------------<BR>")
Response.write("ExpireDate: "& expDate &"<BR>")
Response.write("TodayDate: "& now)
Response.write("<BR>------------------------<BR><BR>")
Response.write(Request.Cookies(aspPoll) &"<BR><BR><BR><BR><BR><BR>")
IF (Request.Cookies(aspPoll) <> "") THEN
Response.write("the cookie is set and running!<BR>"&_
"Cookie Value: "& Request.Cookies(aspPoll))
ELSEIF (Request.Cookies(aspPoll)="") THEN
Response.write("This cookie is not set yet...<BR>")
Response.write("<B> Creating cookie....</B><BR>")
Response.Cookies(aspPoll).Expires = CDate(expDate)
Response.Cookies(aspPoll).Domain = ".Caffeine"
Response.Cookies(aspPoll).Path = "/"
Response.Cookies(aspPoll) = "someText"
Response.write("reload the page and this cookie will be set!!!<BR>")
Response.write("Cookie value: "& Request.Cookies(aspPoll) &"<BR><BR>")
ELSE
Response.write("some other text here...")
END IF
%>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
</BODY>
</HTML>
I really appreciate any help since this is the last thing missing in my poll-system.
thanks,
David
"There are no must's in life unless you provide for someone else than yourself"
-
May 9th, 2001, 04:38 PM
#2
Good Ol' Platypus
Are you sure that you set it correctly? Show us your setting code.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 9th, 2001, 05:20 PM
#3
New Member
Try the following code.
It works fine for me
<% Option Explicit
Response.Buffer = true
Dim expDate, aspPoll
aspPoll = "aspPoll"
expDate = "2001-05-11 21:42" ' for this version this is static, it will be dynamic in the near future
Response.write("------------------------<BR>")
Response.write("ExpireDate: "& expDate &"<BR>")
Response.write("TodayDate: "& now)
Response.write("<BR>------------------------<BR><BR>")
Response.write(Request.Cookies(aspPoll)("Main") &"<BR><BR><BR><BR><BR><BR>")
IF (Request.Cookies(aspPoll)("Main") <> "") THEN
Response.write("the cookie is set and running!<BR>"&_
"Cookie Value: "& Request.Cookies(aspPoll)("Main"))
ELSEIF (Request.Cookies(aspPoll)("Main")="") THEN
Response.write("This cookie is not set yet...<BR>")
Response.write("<B> Creating cookie....</B><BR>")
Response.Cookies(aspPoll).Expires = CDate(expDate)
Response.Cookies(aspPoll)("Main") = "sometext"
Response.Cookies(aspPoll)("Domain") = ".Caffeine"
Response.Cookies(aspPoll)("Path") = "/"
Response.write("reload the page and this cookie will be set!!!<BR>")
Response.write("Cookie value: "& Request.Cookies(aspPoll)("Main") &"<BR><BR>")
Response.write("Domain value: "& Request.Cookies(aspPoll)("Domain") &"<BR><BR>")
Response.write("Path value: "& Request.Cookies(aspPoll)("Path") &"<BR><BR>")
ELSE
Response.write("some other text here...")
END IF
%>
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
</BODY>
</HTML>
-
May 10th, 2001, 07:44 AM
#4
Thread Starter
Member
thanks a lot mentor22!
it works excellent now, but Im not sure where I did wrong.
Is it that I did not use this syntax: Response.Cookies("cookieName")("subItem") ??
if not, can you(or anybody) tell me where my code was incorrect ?
I don't just want to have the code working, I also want to understand it 
thanks again,
David
"There are no must's in life unless you provide for someone else than yourself"
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
|