Table of Contents

Method SetCookie

Namespace
DotNetBrowser.Cookies
Assembly
DotNetBrowser.dll

Sets a session cookie given explicit user-provided cookie attributes.

Task<bool> SetCookie(Cookie cookie)

Parameters

cookie Cookie

An HTTP cookie.

Returns

Task<bool>

true when session cookie was inserted successfully, false otherwise.

If you set the cookie successfully and the method returns true and you decide to find the cookie in the list of all cookies, please note that the cookie storage can modify some cookies attributes, such as domain or expiration time.

Exceptions

ArgumentException

The cookie is null or the cookie cannot be set.

ObjectDisposedException

The ICookieStore has already been disposed.