Assembly: System.Net (in System.Net.dll)
Thetype exposes the following members.
|Add(Uri, Cookie)||Adds the specified Cookie with the specified Uniform Resource Identifier (URI) to this .|
|Add(Uri, CookieCollection)||Adds the contents of the specified CookieCollection with the specified Uniform Resource Identifier (URI) to this .|
|Equals(Object)||Determines whether the specified Object is equal to the current Object. (Inherited from Object.)|
|Finalize||Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)|
|GetCookieHeader||Gets the HTTP cookie header that contains cookies pertaining to the specified Uniform Resource Identifier (URI).|
|GetCookies||Gets the CookieCollection associated with the specified Uniform Resource Identifier (URI).|
|GetHashCode||Serves as a hash function for a particular type. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|MemberwiseClone||Creates a shallow copy of the current Object. (Inherited from Object.)|
|SetCookies||Creates cookie instances for the cookies specified in the HTTP cookie header and adds them to the associated with the specified Uniform Resource Identifier (URI).|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
|DefaultCookieLengthLimit||Represents the default maximum size, in bytes, of the Cookie objects that the can hold. This field is constant.|
|DefaultCookieLimit||Represents the default maximum number of Cookie objects that the can hold. This field is constant.|
|DefaultPerDomainCookieLimit||Represents the default maximum number of Cookie objects that the can reference per domain. This field is constant.|
A provides storage for CookieCollection objects on HttpWebRequest objects through the HttpWebRequest.CookieContainer property. The creates an internal CookieCollection to store cookies associated with a particular Uniform Resource Identifier (URI). A Cookie is retrieved from the container based on its URI as a CookieCollection, or as a string that can be used to submit with HTTP requests.
You must always create a to send with a request if you want cookies to be returned on the response. This is also true for HTTPOnly cookies, which you cannot retrieve.
The has three properties that specify the volume of the content of the container: Capacity, MaxCookieSize, and PerDomainCapacity. These properties have the default values of 300, 4096, and 20 respectively. When a Cookie is added to the container, these properties are used to determine whether a Cookie is already contained in the and whether one or more Cookie objects should be discarded to make room for the new one. The keeps track of each addition to make sure that neither the nor the PerDomainCapacity limits are exceeded. If one or both are exceeded, then Cookie instances held by the are removed. First, any expired Cookie is removed. If additional capacity must be recaptured, then the least-recently-used CookieCollection is purged. If you attempt to add a cookie that already exists, that cookie will be overwritten.
If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.
Windows Phone 8, Windows Phone OS 7.1
For more info, see App capabilities and hardware requirements for Windows Phone 8.