NetworkClientSetCookieAsync Method |
Version 130.1.90
Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.
Namespace: CefSharp.DevTools.NetworkAssembly: CefSharp.Core (in CefSharp.Core.dll) Version: 129.0.110.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,
CookiePartitionKey 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,
CookiePartitionKey^ partitionKey = nullptr
)
Parameters
- name String
- Cookie name.
- value String
- Cookie value.
- url String (Optional)
- 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 String (Optional)
- Cookie domain.
- path String (Optional)
- Cookie path.
- secure NullableBoolean (Optional)
- True if cookie is secure.
- httpOnly NullableBoolean (Optional)
- True if cookie is http-only.
- sameSite NullableCookieSameSite (Optional)
- Cookie SameSite type.
- expires NullableDouble (Optional)
- Cookie expiration date, session cookie if not set
- priority NullableCookiePriority (Optional)
- Cookie Priority type.
- sameParty NullableBoolean (Optional)
- True if cookie is SameParty.
- sourceScheme NullableCookieSourceScheme (Optional)
- Cookie source scheme type.
- sourcePort NullableInt32 (Optional)
- 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 CookiePartitionKey (Optional)
- Cookie partition key. If not set, the cookie will be set as not partitioned.
Return Value
TaskSetCookieResponsereturns System.Threading.Tasks.Task<SetCookieResponse>
See Also