Table of Contents

Class CoreWebView2Cookie

Namespace
Microsoft.Web.WebView2.Core
Assembly
Microsoft.Web.WebView2.Core.dll

Provides a set of properties that are used to manage a CoreWebView2Cookie.

public class CoreWebView2Cookie
Inheritance
CoreWebView2Cookie
Inherited Members

Properties

Domain

Gets the domain for which the cookie is valid.

public string Domain { get; }

Property Value

string

Remarks

The default value is the host that this cookie has been received from. Note that, for instance, .bing.com, bing.com, and www.bing.com are considered different domains.

Expires

The expiration date and time for the cookie since the UNIX epoch.

public DateTime Expires { get; set; }

Property Value

DateTime

Remarks

Setting the Expires property to MinValue makes this a session cookie, which is its default value.

IsHttpOnly

Determines whether this cookie is http-only.

public bool IsHttpOnly { get; set; }

Property Value

bool

IsSecure

Gets or sets the security level of this cookie.

public bool IsSecure { get; set; }

Property Value

bool

IsSession

Determines whether this is a session cookie. The default value is false.

public bool IsSession { get; }

Property Value

bool

Name

Get or sets the cookie name.

public string Name { get; }

Property Value

string

Path

Gets the path for which the cookie is valid.

public string Path { get; }

Property Value

string

Remarks

The default value is "/", which means this cookie will be sent to all pages on the Domain.

SameSite

Determines the SameSite status of the cookie which represents the enforcement mode of the cookie.

public CoreWebView2CookieSameSiteKind SameSite { get; set; }

Property Value

CoreWebView2CookieSameSiteKind

Remarks

The default value is Lax.

Value

Gets or sets the cookie value.

public string Value { get; set; }

Property Value

string

Methods

ToSystemNetCookie()

Converts this to a System.Net.Cookie.

public Cookie ToSystemNetCookie()

Returns

Cookie

An object whose Name, Value, Path, Domain, HttpOnly, Secure, and Expires, matches those Name, Value, Path, Domain, IsHttpOnly, IsSecure, and Expires of this CoreWebView2Cookie object.

Remarks

The values of the Cookie properties other than those specified above remain their default values.

See Also