This documentation is archived and is not being maintained.

HttpCookieCollection.Set Method

Updates the value of an existing cookie in a cookie collection.

[Visual Basic]
Public Sub Set( _
   ByVal cookie As HttpCookie _
)
[C#]
public void Set(
 HttpCookie cookie
);
[C++]
public: void Set(
 HttpCookie* cookie
);
[JScript]
public function Set(
   cookie : HttpCookie
);

Parameters

cookie
The HttpCookie object to update.

Example

The following example updates the value of an existing cookie.

[Visual Basic] 
MyCookie.Value = DateTime.Now().ToString()
 MyCookieCollection.Set(MyCookie)
    

[C#] 
MyCookie.Value = DateTime.Now.ToString();
 MyCookieCollection.Set(MyCookie);
    

[C++] 
MyCookie->Value = DateTime::Now.ToString();
 MyCookieCollection->Set(MyCookie);
    

[JScript] 
myCookie.Value = DateTime.Now.ToString()
myCookieCollection.Set(myCookie)
  

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpCookieCollection Class | HttpCookieCollection Members | System.Web Namespace

Show: