This documentation is archived and is not being maintained.

Cookie.ToString Method

Overrides the ToString method.

[Visual Basic]
Overrides Public Function ToString() As String
[C#]
public override string ToString();
[C++]
public: String* ToString();
[JScript]
public override function ToString() : String;

Return Value

Returns a string representation of this Cookie object suitable for including in a HTTP Cookie: request header.

Remarks

The exact format of the string depends on the RFC this cookie conforms to.

Example

[Visual Basic, C#] The following example displays the string value of a cookie returned in a response. For the complete example, see the Cookie class topic.

[Visual Basic] 
' Show the string representation of the cookie.
Console.WriteLine("String: {0}", cook.ToString())

[C#] 
// Show the string representation of the cookie.
Console.WriteLine ("String: {0}", cook.ToString());

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

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

Cookie Class | Cookie Members | System.Net Namespace

Show: