I cannot access cookies in TIdHTTP!
The client code is like this:
This property is set:
IdHTTP1->AllowCookies = true ;
Count = IdHTTP1->CookieManager->CookieCollection->Count ;
for( int x = 0; x < Count; x++ )
{
Str = IdHTTP1->CookieManager->CookieCollection->Cookies[x]->CookieName ;
Str2 = IdHTTP1->CookieManager->CookieCollection->Cookies[x]->CookieText ;
}
The problem is that
IdHTTP1->CookieManager->CookieCollection->Count
is zero.
I know that the Server side works Ok because when I request the same page in the browser I can display the value of the cookie.
-------------------------------------------------
the server side code:
TDateTime Date ;
Date = Date.CurrentDateTime() ;
Date++ ;
TCookie *pNewCookie = Response->Cookies->Add() ;
pNewCookie->Expires = Date ;
pNewCookie->Secure = false ;
pNewCookie->Name = "cookiename" ;
pNewCookie->Value = "cookieValue" ;
------
when I return this line to the browser:
"\r\nCookieFields:" + Request->CookieFields->Text ;
the cookie and its value are there on the second round trip.
If anyone has any ideas, it will be much appreciated.
Thommy