Class SessionData
Holds session data (cookies and headers) for a single domain. Thread-safe for concurrent access.
public class SessionData
- Inheritance
-
SessionData
- Inherited Members
Constructors
SessionData(string)
public SessionData(string domain)
Parameters
domainstring
Properties
Cookies
Cookies stored for this session (name -> SessionCookie)
public ConcurrentDictionary<string, SessionCookie> Cookies { get; }
Property Value
Domain
Domain this session belongs to
public string Domain { get; }
Property Value
Headers
Custom headers stored for this session (header name -> value)
public ConcurrentDictionary<string, string> Headers { get; }
Property Value
LastUpdated
Timestamp of last update
public DateTime LastUpdated { get; set; }
Property Value
Methods
GetCookieHeaderValue()
Get cookie string for Cookie header (name1=value1; name2=value2)
public string GetCookieHeaderValue()
Returns
RemoveExpiredCookies()
Remove expired cookies from the session
public void RemoveExpiredCookies()
SetCookie(string, string, string?, DateTime?)
Add or update a cookie
public void SetCookie(string name, string value, string? path = null, DateTime? expires = null)
Parameters
SetHeader(string, string)
Add or update a header
public void SetHeader(string name, string value)