I did some investigation, it turns out that the CookieCollection uses a
too-simple string split function instead of actually attempting to "parse"
the cookie. So any cookies that contain commas get mangled. I then tried
to grab the data from the Set-Cookie header, but those values get mangled in
a similar fashion. What's really annoying is that I can see the properly
parsed values in Visual Studio, way down in the private members of the
headers collection, but they're not exposed anywhere except in the Visual
Studio watch window. I ended up creating my own better parser to handle it.
The website I was playing around with was Expedia.com, BTW. I imagine there
are probably a lot of other websites that use commas in cookies - they
should fix the handling behaviour in .NET.
> Do you have a bare bone repro for this ?
>
[quoted text clipped - 15 lines]
>>> into cookies that .NET can't handle. I've also found a couple of other
>>> parsers but they're choking as well.
Bill Woodruff - 20 Apr 2008 03:59 GMT
Mike C# wrote :
"I ended up creating my own better parser to handle it."
Hi Mike,
I imagine there are many people, besides myself, who would really appreciate
a brief tutorial and your solution if you have the time, inclination, and
freedom from contractual constraint, that would allow you to post an article
on CodeProject or a similar venue, or share code.
thanks, Bill
Mike C# - 24 Apr 2008 01:00 GMT
> Mike C# wrote :
>
[quoted text clipped - 8 lines]
> article
> on CodeProject or a similar venue, or share code.
This particular piece of code was part of a work for hire, so I can't post
it without permission. I'll discuss with the person I'm writing it for and
see if they're willing to allow it. If not, I may write another version of
the solution (time permitting) and post that. I really believe the absolute
best solution would be for the .NET team to fix the problem in the
Framework, but until then I guess we just have to make do with custom
parsing solutions :(