NetworkClient.SetCookieAsync Method |
Version 107.1.120
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: 107.1.120.0 (107.1.120.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,
string partitionKey = null
)
public:
Task<SetCookieResponse^>^ SetCookieAsync(
String^ name,
String^ value,
String^ url = nullptr,
String^ domain = nullptr,
String^ path = nullptr,
Nullable<bool> secure = nullptr,
Nullable<bool> httpOnly = nullptr,
Nullable<CookieSameSite> sameSite = nullptr,
Nullable<double> expires = nullptr,
Nullable<CookiePriority> priority = nullptr,
Nullable<bool> sameParty = nullptr,
Nullable<CookieSourceScheme> sourceScheme = nullptr,
Nullable<int> sourcePort = nullptr,
String^ partitionKey = nullptr
)
Parameters
- name
- Type: System.String
Cookie name. - value
- Type: System.String
Cookie value. - url (Optional)
- Type: System.String
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: System.String
Cookie domain. - path (Optional)
- Type: System.String
Cookie path. - secure (Optional)
- Type: System.Nullable<Boolean>
True if cookie is secure. - httpOnly (Optional)
- Type: System.Nullable<Boolean>
True if cookie is http-only. - sameSite (Optional)
- Type: System.Nullable<CookieSameSite>
Cookie SameSite type. - expires (Optional)
- Type: System.Nullable<Double>
Cookie expiration date, session cookie if not set - priority (Optional)
- Type: System.Nullable<CookiePriority>
Cookie Priority type. - sameParty (Optional)
- Type: System.Nullable<Boolean>
True if cookie is SameParty. - sourceScheme (Optional)
- Type: System.Nullable<CookieSourceScheme>
Cookie source scheme type. - sourcePort (Optional)
- Type: System.Nullable<Int32>
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. - partitionKey (Optional)
- Type: System.String
Cookie partition key. The site of the top-level URL the browser was visiting at the startof the request to the endpoint that set the cookie.If not set, the cookie will be set as not partitioned.
Return Value
Type:
Task<SetCookieResponse>returns System.Threading.Tasks.Task<SetCookieResponse>
See Also