Discussion:
InternetGetCookie[Ex]
(too old to reply)
crj
2006-01-09 18:08:05 UTC
Permalink
Can InternetGetCookie[Ex] be used to retrieve 'expires' data for a cookie?

I can (so it seems) set a cookie with InternetSetCookie, and specify an
expires value
but when I use InterGetCookie[Ex] on the same
URL, I don't see the expires value.

I am also confused by the InternetSetCookie API: some docs seem to use
NULL for the name, and
assume that the data section will specify the name -

InternetSetCookie("http://some.url.com", NULL, "a=b")

would set the cookie 'a' to the value 'b'. But
some docs seem to indicate that a name is needed ... what's the right
answer here?

If I do

InternetSetCookie("http://some.url.com", NULL, "a=b; expires = Thu,
31-Dec-2099 23:59:59 GMT")

then when I use InternetGetCookieEx to retrieve the cookie 'a' I don't see
the expires value at all.

What am I missing?

- chris
Scherbina Vladimir
2006-01-10 07:53:54 UTC
Permalink
Post by crj
Can InternetGetCookie[Ex] be used to retrieve 'expires' data for a cookie?
I can (so it seems) set a cookie with InternetSetCookie, and specify an
expires value
but when I use InterGetCookie[Ex] on the same
URL, I don't see the expires value.
I am also confused by the InternetSetCookie API: some docs seem to use
NULL for the name, and
assume that the data section will specify the name -
InternetSetCookie("http://some.url.com", NULL, "a=b")
would set the cookie 'a' to the value 'b'. But
some docs seem to indicate that a name is needed ... what's the right
answer here?
If I do
InternetSetCookie("http://some.url.com", NULL, "a=b; expires = Thu,
31-Dec-2099 23:59:59 GMT")
then when I use InternetGetCookieEx to retrieve the cookie 'a' I don't see
the expires value at all.
What am I missing?
- chris
From MSDN (april 2004):
lpszCookieName: Pointer to a null-terminated string that specifies the name
to be associated with the cookie data. If this parameter is NULL, no name is
associated with the cookie.

AFAIR there is no documented way to retrieve "expires" value of a cookie.
Because it's internal component of a cookie. OTOH you may goto C:\Documents
and Settings\username\Cookies\*.txt, find there your cookie, and analyze
it's structure by hands (CreateFile, ReadFile, etc), expires value is stored
there.

--
Vladimir
crj
2006-01-10 12:47:41 UTC
Permalink
Thanks for the reply - not very encouraging ;-)

I don't really want to start analysing file content
by hand though ...

Unless anyone else has a good idea, I will probably
just have to leave this altogether.

- chris

Loading...