Re: Extracting String Info from WebRequest Cookie

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Joerg Jooss (joerg.jooss_at_gmx.net)
Date: 09/10/04


Date: Fri, 10 Sep 2004 15:42:54 +0200

James Johnson wrote:
> Well, I have discovered that all you have to do to reference a cookie
> in a cookie collection is to provide an index directly to the cookie
> collection such as:
>
> Cookie cookie = myCookieColl[0];

If you're coming from VB.NET: You don't use the Item property in C#.
Instead, you access an item within a collection using the [] operator (aka
indexer), similar to accessing array items.

In additon to accessing a cookie by index, you can also access it by name.

Cookie cookie = myCookieColl["DeliciousCookie"];

> However, I still face the problem of the cookie.Value being encoded.
> Is it bytes? Is it encrypted? How do you deal with the value and
> decode it?

Cookie.Value delivers the value "as is". You have to check with the
server-side application developers how they encoded or encrypted the
value -- chances are, they're not going to tell you ;-)

Cheers,

-- 
Joerg Jooss
joerg.jooss@gmx.net 


Relevant Pages