---
title: HttpContextExtensions
summary: API reference for HttpContextExtensions.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-09-17
library: SAIF.Framework.Web.Mvc
reference_type: package
---

# HttpContextExtensions

Supplies two independent request-inspection helpers used before a web context or authorization decision exists: extracting the context id from the current request, and deciding Glimpse diagnostic-panel access by environment and role.

## Purpose
- Supplies two independent request-inspection helpers used before a web context or authorization decision exists: extracting the context id from the current request, and deciding Glimpse diagnostic-panel access by environment and role.

## Context
- Namespace: `SAIF.Web`
- Assembly/package: `SAIF.Framework.Web.Mvc (source-shipping NuGet package)`
- Kind: static class

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| GetWebContextId(HttpRequestBase) | `public static string GetWebContextId(this HttpRequestBase request)` | Returns the web-context id from the request form field first, then the query string, else an empty string; consumed by the "Resolve web context for an incoming request" operation. |
| HasGlimpseAccess(HttpContextBase) | `public static bool HasGlimpseAccess(this HttpContextBase context)` | Returns whether the current user should see the Glimpse diagnostics panel, using a machine-name-derived environment token and a negated role check; see the "Determine Glimpse diagnostic access" operation. |

## Behavioral notes
- `HasGlimpseAccess`'s role check is negated (`!context.User.IsInRole(string.Format("GlimpseUser{0}Resource", env))`), so an authenticated user who is *not* in the Glimpse role currently receives `true`; whether this is intended could not be confirmed from this repository.**

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `src/Web/Extensions/HttpContextExtensions.cs`
