ICookieService¶
Contract for reading and writing browser cookies, including whole objects serialized as JSON. CookieService implements it.
Purpose¶
- Store the
BolContextcookie and other cookies with a lifetime (BR-BOLMIDDLEWARE-004).
Context¶
- Namespace:
BolMiddleware.Services.CookieService - Assembly/package:
BolMiddleware
Public members¶
| Member | Signature | Purpose |
|---|---|---|
SetCookie |
void SetCookie(string name, string value, int timeout) |
Writes a cookie that expires after the timeout in seconds. |
SetCookieObject<T> |
void SetCookieObject<T>(string name, T value, int timeout) |
Serializes the object and writes it as a cookie. |
GetCookie |
string? GetCookie(string name) |
Reads a cookie value. |
GetCookieObject<T> |
T? GetCookieObject<T>(string name) |
Reads and deserializes a cookie. |
DoesCookieExist |
bool DoesCookieExist(string name) |
Tells whether the request carries the cookie. |
DeleteCookie |
void DeleteCookie(string name) |
Removes the cookie. |
Behavioral notes¶
- Registered as scoped.
Constraints and usage notes¶
- See the implementation page for cookie flags.
Sources¶
- src/BolMiddleware/Services/CookieService/ICookieService.cs