Board index » delphi » Cookies problems ?

Cookies problems ?


2004-01-27 05:59:07 AM
delphi158
Hello,
I would like to use cookies for our website, but when I try to test in
local, nothing is created (even using IP address 127.0.0.1/website) ?
The code to test is :
Procedure CookiesLog;
var
slstCookie:TStringList;
Begin
slstCookie := TStringList.Create;
Try
slstCookie.Clear;
slstCookie.Append('CookieExample=ACookie');
slstCookie.Append('CookieField1=Value1');
slstCookie.Append('CookieField2=Value2');
Response.SetCookieField(slstCookie, '', '/scripts',0,False);
Response.Content := 'Cookie has been set. Thank you!';
Finally
slstCookie.Free;
End;
End;
And the code to read the cookies is :
Response.Content := request.CookieFields.Values['ACookie'];
(tested with Response.Content :=
request.CookieFields.Values['CookieField1']; // same result nothing)
Exit;
Thank you for your help
 
 

Re:Cookies problems ?

Maverick was moved enough, that he took time and energy to create the a news
post (which will probebly come back to haunt him in the future):
Quote
Response.SetCookieField(slstCookie, '', '/scripts',0,False);
Try putting in a host name in that so the cookie knows who it is host is. Some
browsers do not like it when you use 127.0.0.1 so either setup a domain in the
hosts file to link to it our you can just use localhost
If you get stuck again have a read of the cookie article on www.matlus.com
 

Re:Cookies problems ?

Thank you
"Robert MacLean" <XXXX@XXXXX.COM>a écrit dans le message de
Quote
Maverick was moved enough, that he took time and energy to create the a
news
post (which will probebly come back to haunt him in the future):

>Response.SetCookieField(slstCookie, '', '/scripts',0,False);
Try putting in a host name in that so the cookie knows who it is host is.
Some
browsers do not like it when you use 127.0.0.1 so either setup a domain in
the
hosts file to link to it our you can just use localhost

If you get stuck again have a read of the cookie article on www.matlus.com

--
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]
Robert MacLean
XXXX@XXXXX.COM
www.sadev.co.za
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][]