SetCookies Method
Collapse the table of content
Expand the table of content

CookieContainer.SetCookies Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Creates cookie instances for the cookies specified in the HTTP cookie header and adds them to the CookieContainer associated with the specified Uniform Resource Identifier (URI).

Namespace:  System.Net
Assembly:  System.Net (in System.Net.dll)

public void SetCookies(
	Uri uri,
	string cookieHeader
)

Parameters

uri
Type: System.Uri
The URI associated with the cookie container.
cookieHeader
Type: System.String
The HTTP header containing cookies to add to the CookieContainer.

ExceptionCondition
ArgumentNullException

uri is null

-or-

cookieHeader is null

CookieException

One of the cookies is invalid.

-or-

An error occurred while adding one of the cookies to the container.

The cookies contained in cookieHeader should be separated by commas.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft