adworldmedia
asked on
Cookie with value separated by commas parsed incorrectly
I am attempting to read a cookie:
By using an HttpWebRequest CookieContainer call to a web page.
Each and everytime Asp.net c# V2.X reads this as THREE seperate cookies:
How do I correctly read this cookie?
{FFcat=607,19330,15}
By using an HttpWebRequest CookieContainer call to a web page.
Each and everytime Asp.net c# V2.X reads this as THREE seperate cookies:
(FFcat=607}
{19330=}
{15=}
How do I correctly read this cookie?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
None of those links supports what I need to do. I relinquished to the fact that Asp.net will not be able to parse incoming cookies with comma delimited values.
So I have decided I will re-build the cookie from scratch, and re-submit it into the header. But, as I have found out; I can not create or save a new cookie with a value that has commas in it...
I am working with an external web service, and it requires the commas. I can not URLEncode the value, because when submitted it will not work. The external server is looking for comma delimited values. How can I get this to work?
So I have decided I will re-build the cookie from scratch, and re-submit it into the header. But, as I have found out; I can not create or save a new cookie with a value that has commas in it...
I am working with an external web service, and it requires the commas. I can not URLEncode the value, because when submitted it will not work. The external server is looking for comma delimited values. How can I get this to work?
Server Error in '/' Application.
The 'Value'='607,19330,15' part of the cookie is invalid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.CookieException: The 'Value'='607,19330,15' part of the cookie is invalid.
Source Error:
Line 67: passCookie.Add(new Uri("http://88.com"), new Cookie(cookieJar[loop1].Name, cookieJar[loop1].Value));
Line 68: }
Line 69: passCookie.Add(new Uri("http://88.com"), new Cookie("FFcat", "607," + _channelID + ",15"));
Line 70: }
Line 71: return passCookie;
Source File: c:\Users\Joseph\documents\visual studio 2012\websites\cookies\Default.aspx.cs Line: 69
http://stackoverflow.com/questions/1136405/handling-a-comma-inside-a-cookie-value-using-nets-c-system-net-cookie
http://msdn.microsoft.com/en-us/library/aa289495%28v=vs.71%29.aspx
http://en.wikipedia.org/wiki/HTTP_cookie