Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Net.​CookieContainer
Assembly: System.Net.Primitives
Inheritance: object → CookieContainer
Provides a container for a collection of <see cref="T:System.Net.CookieCollection" /> objects.
Fields and Constants
public const
int
DefaultCookieLengthLimit
Represents the default maximum size, in bytes, of the <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. This field is constant.
public const
int
DefaultCookieLimit
Represents the default maximum number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can hold. This field is constant.
public const
int
DefaultPerDomainCookieLimit
Represents the default maximum number of <see cref="T:System.Net.Cookie" /> instances that the <see cref="T:System.Net.CookieContainer" /> can reference per domain. This field is constant.
Properties
public
int
Capacity
Gets or sets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> can hold.
public
int
Count
Gets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> currently holds.
public
int
MaxCookieSize
Represents the maximum allowed length of a <see cref="T:System.Net.Cookie" /> .
public
int
PerDomainCapacity
Gets or sets the number of <see cref="T:System.Net.Cookie" /> instances that a <see cref="T:System.Net.CookieContainer" /> can hold per domain.
Methods
public
void
Add​(Cookie cookie)
cookie
The <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
Adds a <see cref="T:System.Net.Cookie" /> to a <see cref="T:System.Net.CookieContainer" /> . This method uses the domain from the <see cref="T:System.Net.Cookie" /> to determine which domain collection to associate the <see cref="T:System.Net.Cookie" /> with.
public
void
Add​(CookieCollection cookies)
cookies
The <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
Adds the contents of a <see cref="T:System.Net.CookieCollection" /> to the <see cref="T:System.Net.CookieContainer" /> .
public
void
Add​(Uri uri,
Cookie cookie)
uri
The URI of the <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
cookie
The <see cref="T:System.Net.Cookie" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
Adds a <see cref="T:System.Net.Cookie" /> to the <see cref="T:System.Net.CookieContainer" /> for a particular URI.
public
void
Add​(Uri uri,
CookieCollection cookies)
uri
The URI of the <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
cookies
The <see cref="T:System.Net.CookieCollection" /> to be added to the <see cref="T:System.Net.CookieContainer" /> .
Adds the contents of a <see cref="T:System.Net.CookieCollection" /> to the <see cref="T:System.Net.CookieContainer" /> for a particular URI.
public
CookieCollection
GetAllCookies​() Returns A <see cref="T:System.Net.CookieCollection" /> that contains all of the <see cref="T:System.Net.Cookie" /> instances in the container.
Gets a <see cref="T:System.Net.CookieCollection" /> that contains all of the <see cref="T:System.Net.Cookie" /> instances in the container.
public
string
GetCookieHeader​(Uri uri)
uri
The URI of the <see cref="T:System.Net.Cookie" /> instances desired.
Returns An HTTP cookie header, with strings representing <see cref="T:System.Net.Cookie" /> instances delimited by semicolons.
Gets the HTTP cookie header that contains the HTTP cookies that represent the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.
public
CookieCollection
GetCookies​(Uri uri)
uri
The URI of the <see cref="T:System.Net.Cookie" /> instances desired.
Returns A <see cref="T:System.Net.CookieCollection" /> that contains the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.
Gets a <see cref="T:System.Net.CookieCollection" /> that contains the <see cref="T:System.Net.Cookie" /> instances that are associated with a specific URI.
public
void
SetCookies​(Uri uri,
string cookieHeader)
uri
The URI of the <see cref="T:System.Net.CookieCollection" /> .
cookieHeader
The contents of an HTTP set-cookie header as returned by a HTTP server, with <see cref="T:System.Net.Cookie" /> instances delimited by commas.
Adds <see cref="T:System.Net.Cookie" /> instances for one or more cookies from an HTTP cookie header to the <see cref="T:System.Net.CookieContainer" /> for a specific URI.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object