Represents a cookie in the browser.
[Serializable]
public class Cookie
Cookie
Initializes a new instance of the Cookie class with a specific name and value.
public Cookie(string name, string value)
Parameters
name
string
The name of the cookie.
value
string
The value of the cookie.
If the name is null or an empty string, or if it contains a semi-colon.
If the value is null.
Initializes a new instance of the Cookie class with a specific name, value, and path.
public Cookie(string name, string value, string? path)
Parameters
name
string
The name of the cookie.
value
string
The value of the cookie.
path
string
The path of the cookie.
If the name is null or an empty string, or if it contains a semi-colon.
If the value is null.
Initializes a new instance of the Cookie class with a specific name, value, path and expiration date.
public Cookie(string name, string value, string? path, DateTime? expiry)
Parameters
name
string
The name of the cookie.
value
string
The value of the cookie.
path
string
The path of the cookie.
expiry
DateTime?
The expiration date of the cookie.
If the name is null or an empty string, or if it contains a semi-colon.
If the value is null.
Initializes a new instance of the Cookie class with a specific name, value, domain, path and expiration date.
public Cookie(string name, string value, string? domain, string? path, DateTime? expiry)
Parameters
name
string
The name of the cookie.
value
string
The value of the cookie.
domain
string
The domain of the cookie.
path
string
The path of the cookie.
expiry
DateTime?
The expiration date of the cookie.
If the name is null or an empty string, or if it contains a semi-colon.
If the value is null.
Initializes a new instance of the ReturnedCookie class with a specific name, value, domain, path and expiration date.
public Cookie(string name, string value, string? domain, string? path, DateTime? expiry, bool secure, bool isHttpOnly, string? sameSite)
Parameters
name
string
The name of the cookie.
value
string
The value of the cookie.
domain
string
The domain of the cookie.
path
string
The path of the cookie.
expiry
DateTime?
The expiration date of the cookie.
secure
bool
isHttpOnly
bool
sameSite
string
The SameSite value of cookie.
If the name and value are both an empty string, if the name contains a semi-colon, or if same site value is not valid.
If the name, value or currentUrl is null.
Gets the domain of the cookie.
[JsonPropertyName("domain")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Domain { get; }
Property Value
Gets the expiration date of the cookie.
[JsonIgnore]
public DateTime? Expiry { get; }
Property Value
Gets a value indicating whether the cookie is an HTTP-only cookie.
[JsonPropertyName("httpOnly")]
public virtual bool IsHttpOnly { get; }
Property Value
Gets the name of the cookie.
[JsonPropertyName("name")]
public string Name { get; }
Property Value
Gets the path of the cookie.
[JsonPropertyName("path")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public virtual string? Path { get; }
Property Value
Gets the SameSite setting for the cookie.
[JsonPropertyName("sameSite")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public virtual string? SameSite { get; }
Property Value
Gets a value indicating whether the cookie is secure.
[JsonPropertyName("secure")]
public virtual bool Secure { get; }
Property Value
Gets the value of the cookie.
[JsonPropertyName("value")]
public string Value { get; }
Property Value
Determines whether the specified Object is equal to the current Object.
public override bool Equals(object? obj)
Parameters
Returns
FromDictionary(Dictionary<string, object?>)
Converts a Dictionary to a Cookie.
public static Cookie FromDictionary(Dictionary<string, object?> rawCookie)
Parameters
rawCookie
Dictionary<string, object>
The Dictionary object containing the cookie parameters.
A Cookie object with the proper parameters set.
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
A hash code for the current Object.
Creates and returns a string representation of the cookie.
public override string ToString()
Returns
A string representation of the cookie.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4