Home All Groups Group Topic Archive Search About
Author
15 Jan 2005 8:02 PM
Mark
Would I be right in saying that there are no classes in .Net to read and
parse all the cookies on a PC (not just those associated with a particular
session), and that if I wanted to list them all (along with all the values),
I'd have to parse them manually from the cookies directory? The latter's not
too hard, but it's always nice of someone's already done the hard work for
you. :-)

Author
16 Jan 2005 8:42 AM
Joerg Jooss
Mark wrote:

> Would I be right in saying that there are no classes in .Net to read
> and parse all the cookies on a PC (not just those associated with a
> particular session), and that if I wanted to list them all (along
> with all the values), I'd have to parse them manually from the
> cookies directory? The latter's not too hard, but it's always nice of
> someone's already done the hard work for you. :-)

There's a Win32 API to parse all IE cookies:

[DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
extern static bool InternetGetCookie (
    string urlName,
    string cookieName,
    StringBuilder cookieData,
    ref int size);

YOu'll probably find similar Mozilla APIs for Firefox/Mozilla.

Cheers,
--
http://www.joergjooss.de
mailto:news-re***@joergjooss.de
Author
16 Jan 2005 6:17 PM
Mark
Show quote
"Joerg Jooss" <news-re***@joergjooss.de> wrote in message
news:xn0dxbjo325ak92000@msnews.microsoft.com...
> Mark wrote:
>
>> Would I be right in saying that there are no classes in .Net to read
>> and parse all the cookies on a PC (not just those associated with a
>> particular session), and that if I wanted to list them all (along
>> with all the values), I'd have to parse them manually from the
>> cookies directory? The latter's not too hard, but it's always nice of
>> someone's already done the hard work for you. :-)
>
> There's a Win32 API to parse all IE cookies:
>
> [DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
> extern static bool InternetGetCookie (
>  string urlName,
> string cookieName,
> StringBuilder cookieData,
> ref int size);
>
> YOu'll probably find similar Mozilla APIs for Firefox/Mozilla.
>

Perfect - thanks very much. :-)

Show quote
> Cheers,
> --
> http://www.joergjooss.de
> mailto:news-re***@joergjooss.de
Author
17 Jan 2005 2:12 PM
Mark
Show quote
"Mark" <m***@REMOVETHISBITmossywell.com> wrote in message
news:41eaafd3$0$26915$cc9e4d1f@news.dial.pipex.com...
> "Joerg Jooss" <news-re***@joergjooss.de> wrote in message
> news:xn0dxbjo325ak92000@msnews.microsoft.com...
>> Mark wrote:
>>
>>> Would I be right in saying that there are no classes in .Net to read
>>> and parse all the cookies on a PC (not just those associated with a
>>> particular session), and that if I wanted to list them all (along
>>> with all the values), I'd have to parse them manually from the
>>> cookies directory? The latter's not too hard, but it's always nice of
>>> someone's already done the hard work for you. :-)
>>
>> There's a Win32 API to parse all IE cookies:
>>
>> [DllImport("wininet.dll", CharSet=CharSet.Auto, SetLastError=true)]
>> extern static bool InternetGetCookie (
>>  string urlName,
>> string cookieName,
>> StringBuilder cookieData,
>> ref int size);
>>
>> YOu'll probably find similar Mozilla APIs for Firefox/Mozilla.
>>

I tried this out and as far as I can tell, InternetGetCookie expects a URL
as one of the arguments. So, I have to know the URL to start with which
means retrieving it manually from each cookie one by one. However, if I'm
going to do that I might as well parse the whole cookie and forget about
InternetGetCookie, I think. Is this right?


Show quote
>
> Perfect - thanks very much. :-)
>
>> Cheers,
>> --
>> http://www.joergjooss.de
>> mailto:news-re***@joergjooss.de
>
>

AddThis Social Bookmark Button