---
title: IContextCookieHelper
summary: API reference for IContextCookieHelper.
status: draft
owner: SAIF IT Core Services
last_reviewed: 2026-10-12
library: BolMiddleware
reference_type: package
---

# IContextCookieHelper

Contract for managing per-user settings stored inside the `ContextCookie` payload. `ContextCookieHelperService` implements it.

## Purpose
- Let applications add, read, and remove small user settings without touching the cookie format.

## Context
- Namespace: `BolMiddleware.ContextCookieHelper`
- Assembly/package: `BolMiddleware`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `AddUserSetting` | `void AddUserSetting(string key, string value, ContextCookie cookie)` | Adds or replaces a setting in the cookie payload. |
| `RemoveUserSetting` | `void RemoveUserSetting(string key, ContextCookie cookie)` | Removes the setting. |
| `GetUserSetting` | `bool GetUserSetting(string key, ContextCookie cookie, out string value)` | Reads a setting and reports whether it exists. |
| `DoesUserSettingExist` | `bool DoesUserSettingExist(string key, ContextCookie cookie)` | Tells whether the setting exists. |

## Behavioral notes
- A null key throws `ArgumentNullException`.

## Constraints and usage notes
- The cookie must be saved afterward for the change to persist.

## Sources
- src/BolMiddleware/ContextCookieHelper/IContextCookieHelper.cs
