HttpCookieManager.SetCookie(HttpCookie) | setCookie(HttpCookie) method

Applies to Windows and Windows Phone

Add or change an HttpCookie in the cookies associated with an app that is sent on future requests.

Syntax


var boolean = httpCookieManager.setCookie(cookie);

Parameters

cookie

Type: HttpCookie

The HttpCookie to change or add.

Return value

Type: Boolean [JavaScript] | System.Boolean [.NET] | Platform::Boolean [C++]

true if the HttpCookie replaced an existing cookie; otherwise false.

Remarks

If the HttpCookie already exists, then the values and parameters associated the HttpCookie are updated.

If the HttpCookie does not exist, then the HttpCookie is added.

The added or changed HttpCookie will be sent on subsequent HTTP requests.

Setting an HttpCookie doesn't update the HttpCookieCollection previously returned by the GetCookies method.

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http
Windows::Web::Http [C++]

Metadata

Windows.winmd

See also

HttpCookieManager
SetCookie(HttpCookie, Boolean)

 

 

Show:
© 2014 Microsoft