Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Nov : Re: TIdCookieManager.AddCookie
| Subject: | Re: TIdCookieManager.AddCookie |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Thu, 22 Nov 2007 13:26:32 |
"MrT" <contact@heat-mi.org> wrote in message
news:4745c40d@newsgroups.borland.com...
> How is
>
>
IdHttpClient1.CookieManager.AddCookie('MyCookie=MyCookieValue','www.mydomain
.com');
> this used, where should it be called
Unless you are storing cookies to your own files, then you do not need to
call AddCookie() yourself at all.
> how is it related to:
>
> TIdCookieManager.OnNewCookie
OnNewCookie is triggered whenever a valid cookie is passed to AddCookie() or
AddCookie2().
> Seems like OnNewCookie fires on AddCookie but
> also fires when I connect to a site that sends cookie.
AddCookie() and AddCookie() are called when TIdHTTP processes a responses
'Set-cookie' and 'Set-cookie2' headers.
> When a site sends a cookie, I see no OnCookieReceived or
> some such event.
OnNewCookie is that event.
> Does the cookie manager send back the cookie automatically
> when a site requests the cookie?
Yes. Though a site does not request cookies. Any cookie that matches the
page being requested is always sent as part of the request.
Gambit