HttpCookie.HttpCookie(String, String) Constructor

Creates, names, and assigns a value to a new cookie.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public:
HttpCookie (
	String^ name, 
	String^ value
)
public HttpCookie (
	String name, 
	String value
)
public function HttpCookie (
	name : String, 
	value : String
)
Not applicable.

Parameters

name

The name of the new cookie.

value

The value of the new cookie.

The following code example creates, names, and sets the value of a new cookie.

No code example is currently available or this language may not be supported.
HttpCookie myCookie = 
    new HttpCookie("LastVisit", DateTime.get_Now().ToString());

var myCookie : HttpCookie = new HttpCookie("LastVisit", String(DateTime.Now))
    

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: