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

# ContextCookie

Payload serialized into the short-lived `BolContext` cookie. It carries the resolved context, the user type and state, and per-user settings between requests so the page models need not repeat lookups.

## Purpose
- Remember whether the user is external and whether that was already validated ([BR-BOLMIDDLEWARE-006](../../business-rules.md#br-bolmiddleware-006-external-user-information-lookup-once)).
- Hold the context result and user settings for the cookie lifetime ([BR-BOLMIDDLEWARE-004](../../business-rules.md#br-bolmiddleware-004-context-cookie-lifetime-and-flags)).

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `contextResult` | `ContextResult contextResult` | Context returned from the BOL Context API for the current user. |
| `cookieName` | `string cookieName = "BolContext"` | Name of the cookie that stores this payload. |
| `userType` | `CurrentUserType userType = Unknown` | Whether the user is internal or external. |
| `userState` | `CurrentUserState userState = New` | Whether the external user lookup was completed. |
| `userSettings` | `Dictionary<string,string> userSettings` | Free-form per-user values managed through `IContextCookieHelper`. |
| `cookieTracking` | `List<string> cookieTracking` | Names of cookies the library has set, kept for tracking. |

## Behavioral notes
- The cookie is not signed or encrypted, so its content can be altered by the client.

## Constraints and usage notes
- Keep the payload small; it travels on every request.

## Sources
- src/BolMiddleware/Models/ContextCookie.cs
