GetCookieHeader Method
Collapse the table of content
Expand the table of content

CookieContainer.GetCookieHeader Method (Uri)


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

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

Public Function GetCookieHeader (
	uri As Uri
) As String


Type: System.Uri

The URI of the Cookie instances desired.

Return Value

Type: System.String

An HTTP cookie header, with strings representing Cookie instances delimited by semicolons.

Exception Condition

uri is null.

GetCookieHeader returns a string that holds the HTTP cookie header for the Cookie instances specified by uri. The HTTP header is built by adding a string representation of each Cookie associated with uri. Note that the exact format of the string depends on the RFC that the Cookie conforms to. The strings for all the Cookie instances that are associated with uri are combined and delimited by semicolons.

This string is not in the correct format for use as the second parameter of the SetCookies method.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft