Click or drag to resize

NetworkClientSetCookieAsync Method

Version 93.1.111
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.

Namespace:  CefSharp.DevTools.Network
Assembly:  CefSharp (in CefSharp.dll) Version: 93.1.111.0 (93.1.111.0)
Syntax
public Task<SetCookieResponse> SetCookieAsync(
	string name,
	string value,
	string url = null,
	string domain = null,
	string path = null,
	bool? secure = null,
	bool? httpOnly = null,
	CookieSameSite? sameSite = null,
	double? expires = null,
	CookiePriority? priority = null,
	bool? sameParty = null,
	CookieSourceScheme? sourceScheme = null,
	int? sourcePort = null
)

Parameters

name
Type: SystemString
Cookie name.
value
Type: SystemString
Cookie value.
url (Optional)
Type: SystemString
The request-URI to associate with the setting of the cookie. This value can affect thedefault domain, path, source port, and source scheme values of the created cookie.
domain (Optional)
Type: SystemString
Cookie domain.
path (Optional)
Type: SystemString
Cookie path.
secure (Optional)
Type: SystemNullableBoolean
True if cookie is secure.
httpOnly (Optional)
Type: SystemNullableBoolean
True if cookie is http-only.
sameSite (Optional)
Type: SystemNullableCookieSameSite
Cookie SameSite type.
expires (Optional)
Type: SystemNullableDouble
Cookie expiration date, session cookie if not set
priority (Optional)
Type: SystemNullableCookiePriority
Cookie Priority type.
sameParty (Optional)
Type: SystemNullableBoolean
True if cookie is SameParty.
sourceScheme (Optional)
Type: SystemNullableCookieSourceScheme
Cookie source scheme type.
sourcePort (Optional)
Type: SystemNullableInt32
Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port.An unspecified port value allows protocol clients to emulate legacy cookie scope for the port.This is a temporary ability and it will be removed in the future.

Return Value

Type: TaskSetCookieResponse
returns System.Threading.Tasks.Task<SetCookieResponse>
See Also