Skip to content

Added cookie accessor/iterator to CookieContainer #44094

Description

@shravan2x

Background and Motivation

There's currently no way to access all cookies in a CookieContainer instance without known their domain names. CookieContainer also does not expose a list of domains it holds cookies for. I propose adding a GetAllCookies() method for this. It seems I'm not the only one with a use-case for it https://stackoverflow.com/questions/15983166/how-can-i-get-all-cookies-of-a-cookiecontainer

Latest API proposal

Based on discussion below - #44094 (comment)

public class CookieContainer
{
  // Existing API:
  public CookieCollection GetCookies(Uri uri);

  // Proposed API:
  public CookieCollection GetAllCookies();
}

Original API proposal

 public IEnumerable<Cookie> GetAllCookies();

or

class CookieContainer : IEnumerable<Cookie>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions