Dela via


HttpCookieManager.SetCookie Method

Definition

Overloads

SetCookie(HttpCookie)

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

SetCookie(HttpCookie, Boolean)

Add or change an HttpCookie in the cookies associated with an app.

SetCookie(HttpCookie)

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

public:
 virtual bool SetCookie(HttpCookie ^ cookie) = SetCookie;
/// [Windows.Foundation.Metadata.Overload("SetCookie")]
bool SetCookie(HttpCookie const& cookie);
[Windows.Foundation.Metadata.Overload("SetCookie")]
public bool SetCookie(HttpCookie cookie);
function setCookie(cookie)
Public Function SetCookie (cookie As HttpCookie) As Boolean

Parameters

cookie
HttpCookie

The HttpCookie to change or add.

Returns

Boolean

bool

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

Attributes

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.

See also

Applies to

SetCookie(HttpCookie, Boolean)

Add or change an HttpCookie in the cookies associated with an app.

public:
 virtual bool SetCookie(HttpCookie ^ cookie, bool thirdParty) = SetCookie;
/// [Windows.Foundation.Metadata.Overload("SetCookieWithThirdParty")]
bool SetCookie(HttpCookie const& cookie, bool const& thirdParty);
[Windows.Foundation.Metadata.Overload("SetCookieWithThirdParty")]
public bool SetCookie(HttpCookie cookie, bool thirdParty);
function setCookie(cookie, thirdParty)
Public Function SetCookie (cookie As HttpCookie, thirdParty As Boolean) As Boolean

Parameters

cookie
HttpCookie

The HttpCookie to change or add.

thirdParty
Boolean

bool

A value that indicates whether the HttpCookie is a third party HTTP cookie.

Returns

Boolean

bool

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

Attributes

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 based on policy. For example, the policy might be to reject third-party cookies.

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.

See also

Applies to