Click here to Skip to main content
15,920,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have sent a request to a web site and got the response in which I have logged in and stored in a cookie container.

Now how do I edit a cookie from a cookie container??

PLEASE HELP!! THANKS IN ADVANCE!!
Posted
Updated 6-Apr-11 3:06am
v2
Comments
Dylan Morley 6-Apr-11 14:07pm    
When I first saw this I thought it said 'Eating a cookie in a cookie container'

I'm hungry.

1 solution

How about this code snippet? Your query is a general query. if you are specific about something then you may expect a better answer.

C#
CookieContainer cookieJar = new CookieContainer();

CookieCollection cCol=cookieJar.GetCookies(Request.Url);
foreach (Cookie cookie in cCol)
{
    if (cookie.Name == "myCookie")
    {
        cookie.Value = "100";
        Response.Cookies.Add(new HttpCookie(cookie.Name,cookie.Value));
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900