mscorlib(4.0.0.0) API with additions
System.Net.CookieContainer Class Reference

Provides a container for a collection of T:System.Net.CookieCollection objects. More...

Public Member Functions

 CookieContainer ()
 Initializes a new instance of the T:System.Net.CookieContainer class. More...
 
 CookieContainer (int capacity)
 Initializes a new instance of the T:System.Net.CookieContainer class with a specified value for the number of T:System.Net.Cookie instances that the container can hold. More...
 
 CookieContainer (int capacity, int perDomainCapacity, int maxCookieSize)
 Initializes a new instance of the T:System.Net.CookieContainer class with specific properties. More...
 
void Add (Cookie cookie)
 Adds a T:System.Net.Cookie to a T:System.Net.CookieContainer. This method uses the domain from the T:System.Net.Cookie to determine which domain collection to associate the T:System.Net.Cookie with. More...
 
void Add (CookieCollection cookies)
 Adds the contents of a T:System.Net.CookieCollection to the T:System.Net.CookieContainer. More...
 
void Add (Uri uri, Cookie cookie)
 Adds a T:System.Net.Cookie to the T:System.Net.CookieContainer for a particular URI. More...
 
void Add (Uri uri, CookieCollection cookies)
 Adds the contents of a T:System.Net.CookieCollection to the T:System.Net.CookieContainer for a particular URI. More...
 
CookieCollection GetCookies (Uri uri)
 Gets a T:System.Net.CookieCollection that contains the T:System.Net.Cookie instances that are associated with a specific URI. More...
 
string GetCookieHeader (Uri uri)
 Gets the HTTP cookie header that contains the HTTP cookies that represent the T:System.Net.Cookie instances that are associated with a specific URI. More...
 
void SetCookies (Uri uri, string cookieHeader)
 Adds T:System.Net.Cookie instances for one or more cookies from an HTTP cookie header to the T:System.Net.CookieContainer for a specific URI. More...
 

Public Attributes

const int DefaultCookieLimit = 300
 Represents the default maximum number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold. This field is constant. More...
 
const int DefaultPerDomainCookieLimit = 20
 Represents the default maximum number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can reference per domain. This field is constant. More...
 
const int DefaultCookieLengthLimit = 4096
 Represents the default maximum size, in bytes, of the T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold. This field is constant. More...
 

Properties

int Capacity [get, set]
 Gets and sets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer can hold. More...
 
int Count [get]
 Gets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer currently holds. More...
 
int MaxCookieSize [get, set]
 Represents the maximum allowed length of a T:System.Net.Cookie. More...
 
int PerDomainCapacity [get, set]
 Gets and sets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer can hold per domain. More...
 

Detailed Description

Provides a container for a collection of T:System.Net.CookieCollection objects.

Definition at line 13 of file CookieContainer.cs.

Constructor & Destructor Documentation

◆ CookieContainer() [1/3]

System.Net.CookieContainer.CookieContainer ( )

Initializes a new instance of the T:System.Net.CookieContainer class.

Definition at line 139 of file CookieContainer.cs.

◆ CookieContainer() [2/3]

System.Net.CookieContainer.CookieContainer ( int  capacity)

Initializes a new instance of the T:System.Net.CookieContainer class with a specified value for the number of T:System.Net.Cookie instances that the container can hold.

Parameters
capacityThe number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold.
Exceptions
T:System.ArgumentExceptioncapacity is less than or equal to zero.

Definition at line 152 of file CookieContainer.cs.

◆ CookieContainer() [3/3]

System.Net.CookieContainer.CookieContainer ( int  capacity,
int  perDomainCapacity,
int  maxCookieSize 
)

Initializes a new instance of the T:System.Net.CookieContainer class with specific properties.

Parameters
capacityThe number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold.
perDomainCapacityThe number of T:System.Net.Cookie instances per domain.
maxCookieSizeThe maximum size in bytes for any single T:System.Net.Cookie in a T:System.Net.CookieContainer.
Exceptions
T:System.ArgumentOutOfRangeExceptionperDomainCapacity is not equal to F:System.Int32.MaxValue. and (perDomainCapacity is less than or equal to zero or perDomainCapacity is greater than capacity) .
T:System.ArgumentExceptionmaxCookieSize is less than or equal to zero.

Definition at line 171 of file CookieContainer.cs.

Member Function Documentation

◆ Add() [1/4]

void System.Net.CookieContainer.Add ( Cookie  cookie)

Adds a T:System.Net.Cookie to a T:System.Net.CookieContainer. This method uses the domain from the T:System.Net.Cookie to determine which domain collection to associate the T:System.Net.Cookie with.

Parameters
cookieThe T:System.Net.Cookie to be added to the T:System.Net.CookieContainer.
Exceptions
T:System.ArgumentNullExceptioncookie is null.
T:System.ArgumentExceptionThe domain for cookie is null or the empty string ("").
T:System.Net.CookieExceptioncookie is larger than maxCookieSize . -or- the domain for cookie is not a valid URI.

Definition at line 193 of file CookieContainer.cs.

◆ Add() [2/4]

void System.Net.CookieContainer.Add ( CookieCollection  cookies)

Adds the contents of a T:System.Net.CookieCollection to the T:System.Net.CookieContainer.

Parameters
cookiesThe T:System.Net.CookieCollection to be added to the T:System.Net.CookieContainer.
Exceptions
T:System.ArgumentNullExceptioncookies is null.

Definition at line 447 of file CookieContainer.cs.

◆ Add() [3/4]

void System.Net.CookieContainer.Add ( Uri  uri,
Cookie  cookie 
)

Adds a T:System.Net.Cookie to the T:System.Net.CookieContainer for a particular URI.

Parameters
uriThe URI of the T:System.Net.Cookie to be added to the T:System.Net.CookieContainer.
cookieThe T:System.Net.Cookie to be added to the T:System.Net.CookieContainer.
Exceptions
T:System.ArgumentNullExceptionuri is null or cookie is null.
T:System.Net.CookieExceptioncookie is larger than maxCookieSize . -or- The domain for cookie is not a valid URI.

Definition at line 519 of file CookieContainer.cs.

◆ Add() [4/4]

void System.Net.CookieContainer.Add ( Uri  uri,
CookieCollection  cookies 
)

Adds the contents of a T:System.Net.CookieCollection to the T:System.Net.CookieContainer for a particular URI.

Parameters
uriThe URI of the T:System.Net.CookieCollection to be added to the T:System.Net.CookieContainer.
cookiesThe T:System.Net.CookieCollection to be added to the T:System.Net.CookieContainer.
Exceptions
T:System.ArgumentNullExceptioncookies is null.
T:System.ArgumentExceptionThe domain for one of the cookies in cookies is null.
T:System.Net.CookieExceptionOne of the cookies in cookies contains an invalid domain.

Definition at line 542 of file CookieContainer.cs.

◆ GetCookieHeader()

string System.Net.CookieContainer.GetCookieHeader ( Uri  uri)

Gets the HTTP cookie header that contains the HTTP cookies that represent the T:System.Net.Cookie instances that are associated with a specific URI.

Parameters
uriThe URI of the T:System.Net.Cookie instances desired.
Returns
An HTTP cookie header, with strings representing T:System.Net.Cookie instances delimited by semicolons.
Exceptions
T:System.ArgumentNullExceptionuri is null.

Definition at line 786 of file CookieContainer.cs.

◆ GetCookies()

CookieCollection System.Net.CookieContainer.GetCookies ( Uri  uri)

Gets a T:System.Net.CookieCollection that contains the T:System.Net.Cookie instances that are associated with a specific URI.

Parameters
uriThe URI of the T:System.Net.Cookie instances desired.
Returns
A T:System.Net.CookieCollection that contains the T:System.Net.Cookie instances that are associated with a specific URI.
Exceptions
T:System.ArgumentNullExceptionuri is null.

Definition at line 627 of file CookieContainer.cs.

◆ SetCookies()

void System.Net.CookieContainer.SetCookies ( Uri  uri,
string  cookieHeader 
)

Adds T:System.Net.Cookie instances for one or more cookies from an HTTP cookie header to the T:System.Net.CookieContainer for a specific URI.

Parameters
uriThe URI of the T:System.Net.CookieCollection.
cookieHeaderThe contents of an HTTP set-cookie header as returned by a HTTP server, with T:System.Net.Cookie instances delimited by commas.
Exceptions
T:System.ArgumentNullExceptionuri is null.
T:System.ArgumentNullExceptioncookieHeader is null.
T:System.Net.CookieExceptionOne of the cookies is invalid. -or- An error occurred while adding one of the cookies to the container.

Definition at line 819 of file CookieContainer.cs.

Member Data Documentation

◆ DefaultCookieLengthLimit

const int System.Net.CookieContainer.DefaultCookieLengthLimit = 4096

Represents the default maximum size, in bytes, of the T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold. This field is constant.

Definition at line 25 of file CookieContainer.cs.

◆ DefaultCookieLimit

const int System.Net.CookieContainer.DefaultCookieLimit = 300

Represents the default maximum number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can hold. This field is constant.

Definition at line 17 of file CookieContainer.cs.

◆ DefaultPerDomainCookieLimit

const int System.Net.CookieContainer.DefaultPerDomainCookieLimit = 20

Represents the default maximum number of T:System.Net.Cookie instances that the T:System.Net.CookieContainer can reference per domain. This field is constant.

Definition at line 21 of file CookieContainer.cs.

Property Documentation

◆ Capacity

int System.Net.CookieContainer.Capacity
getset

Gets and sets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer can hold.

Returns
The number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer can hold. This is a hard limit and cannot be exceeded by adding a T:System.Net.Cookie.
Exceptions
T:System.ArgumentOutOfRangeExceptionCapacity is less than or equal to zero or (value is less than P:System.Net.CookieContainer.PerDomainCapacity and P:System.Net.CookieContainer.PerDomainCapacity is not equal to F:System.Int32.MaxValue).

Definition at line 51 of file CookieContainer.cs.

◆ Count

int System.Net.CookieContainer.Count
get

Gets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer currently holds.

Returns
The number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer currently holds. This is the total of T:System.Net.Cookie instances in all domains.

Definition at line 77 of file CookieContainer.cs.

◆ MaxCookieSize

int System.Net.CookieContainer.MaxCookieSize
getset

Represents the maximum allowed length of a T:System.Net.Cookie.

Returns
The maximum allowed length, in bytes, of a T:System.Net.Cookie.
Exceptions
T:System.ArgumentOutOfRangeExceptionMaxCookieSize is less than or equal to zero.

Definition at line 91 of file CookieContainer.cs.

◆ PerDomainCapacity

int System.Net.CookieContainer.PerDomainCapacity
getset

Gets and sets the number of T:System.Net.Cookie instances that a T:System.Net.CookieContainer can hold per domain.

Returns
The number of T:System.Net.Cookie instances that are allowed per domain.
Exceptions
T:System.ArgumentOutOfRangeExceptionPerDomainCapacity is less than or equal to zero. -or- (PerDomainCapacity is greater than the maximum allowable number of cookies instances, 300, and is not equal to F:System.Int32.MaxValue).

Definition at line 115 of file CookieContainer.cs.


The documentation for this class was generated from the following file: