Export (0) Print
Expand All

HttpResponse.SetCookie Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Updates an existing cookie in the cookie collection.

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

member SetCookie : 
        cookie:HttpCookie -> unit

Parameters

cookie
Type: System.Web.HttpCookie

The cookie in the collection to be updated.

ExceptionCondition
HttpException

The cookie is set after the HTTP headers have been sent.

HttpException

Attempted to set the cookie after the HTTP headers were sent.

HttpException

The cookie is set after the HTTP headers have been sent.

HttpException

Attempted to set the cookie after the HTTP headers were sent.

The following example updates the value of an existing cookie.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
Show:
© 2015 Microsoft