This documentation is archived and is not being maintained.

CookieContainer.GetCookieHeader Method

Gets the HTTP cookie header containing the HTTP cookies representing the Cookie instances associated with a specific URI.

[Visual Basic]
Public Function GetCookieHeader( _
   ByVal uri As Uri _
) As String
public string GetCookieHeader(
 Uri uri
public: String* GetCookieHeader(
 Uri* uri
public function GetCookieHeader(
   uri : Uri
) : String;


The URI of the Cookie instances desired.

Return Value

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


Exception Type Condition
ArgumentNullException uri is a null reference (Nothing in Visual Basic)


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 the exact format of the string depends on the RFC the Cookie conforms to. The strings for all the Cookie instances 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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

CookieContainer Class | CookieContainer Members | System.Net Namespace | Cookie | CookieCollection | CookieContainer | CookieException