Remove Cookies From CookieContainer Class
The CookieContainer class does not contain a method that clears or removes the cookies associated with it. To remove them, you have to set each cookie's Expired property
to True as shown below.
C#
VB.NET
C#
1 2 3 4 | var cookies = cookieContainer.GetCookies(new Uri("http://your_url_example_here")); foreach (Cookie co in cookies) { co.Expired = true; } |
VB.NET
1 2 3 4 | Dim cookies = cookieContainer.GetCookies(New Uri("http://your_url_example_here")) For Each co As Cookie In cookies co.Expired = True Next |
Comments
Post a Comment