System.Net.CookieContainer.SetCookies Method

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

Syntax

public void SetCookies (Uri uri, string cookieHeader)

Parameters

uri
The URI of the System.Net.CookieCollection.
cookieHeader
The contents of an HTTP set-cookie header as returned by a HTTP server, with System.Net.Cookie instances delimited by commas.

Remarks

CookieContainer.SetCookies(Uri, string) pulls all the HTTP cookies out of the HTTP cookie header, builds a System.Net.Cookie for each one, and then adds each System.Net.Cookie to the internal System.Net.CookieCollection that is associated with the URI. The HTTP cookies in the cookieHeader string must be delimited by commas.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0