---
title: clsOnlineContext
summary: API reference for clsOnlineContext.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-08-17
library: SAIF.Presentation.Web.MVC
reference_type: package
---

# clsOnlineContext

`clsOnlineContext` is a `clsContext` specialization dedicated to the "Online" SAIF application: its constructor fixes `ApplicationName` to the literal `"Online"` and requires the caller to supply an already-established `clsSecurityPrincipal`, rather than relying on `clsControllerBase.SecurityCheck` to establish one. It also exposes a `Shadows`-declared `savecontext` wrapper around the inherited `SaveContext`, making that otherwise `Protected Friend` operation callable as a public method on this type.

## Purpose
- Provides a ready-made context for the "Online" application that does not need `ApplicationName` set separately by the controller.
- Accepts a pre-established security principal directly through its constructor, for callers that already have one rather than going through the standard `SecurityCheck` pipeline.
- Publicly exposes context persistence (`savecontext`) so callers with a `clsOnlineContext` reference can trigger a save without going through a `clsControllerBase.Navigate` call.

## Context
- Namespace: `SAIF.Presentation.Web.MVC`*
- Assembly/package: `SAIF.Presentation.Web.MVC`

This type inherits from `clsContext`, a local type in this same library (see [clsContext](clsContext.md)); the members below include both its own new members and, per the self-containment rule, the complete inherited public surface it gains from `clsContext`.

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `New` | `Public Sub New(ByVal inSecPrinc As clsSecurityPrincipal)` | Constructs the context with the given security principal and `ApplicationName` fixed to `"Online"` |
| `savecontext` | `Public Shadows Sub savecontext(ByVal inSessionID As String)` | Publicly callable wrapper that calls the inherited (`Protected Friend`) `SaveContext(inSessionID)`; see [Persist context rows](../../operations/persist-context-rows.md) |
| `claimId` (inherited) | `Public Property claimId() As Decimal` | Well-known context field carrying the current claim identifier |
| `policyNum` (inherited) | `Public Property policyNum() As Integer` | Well-known context field carrying the current policy number |
| `SAIFClaimNum` (inherited) | `Public Property SAIFClaimNum() As String` | Well-known context field carrying the SAIF-formatted claim number |
| `ProviderLocationSeqNum` (inherited) | `Public Property ProviderLocationSeqNum() As Integer` | Well-known context field carrying a provider location sequence number |
| `SecurityPrincipal` (inherited) | `Public Property SecurityPrincipal() As clsSecurityPrincipal` | The identity carried by this context; fixed at construction time by `clsOnlineContext.New` but still settable afterward through the inherited property |
| `UserName` (inherited) | `Public ReadOnly Property UserName() As String` | Legacy accessor for the current user's name, derived from `SecurityPrincipal` |
| `UserID` (inherited) | `Public ReadOnly Property UserID() As String` | Returns `SecurityPrincipal.UserName.ToUpper()`, or an empty string when no principal is set |
| `GetContext` (inherited) | `Public Function GetContext(ByVal key As String) As String` | Reads a generic named context value previously set with `SetContext` |
| `SetContext` (inherited) | `Public Sub SetContext(ByVal key As String, ByVal value As String)` | Writes a generic named context value into the in-memory context bag |

## Behavioral notes
- Because the constructor sets `ApplicationName` to the fixed literal `"Online"` (via `MyBase.ApplicationName`, bypassing the `Friend` setter restriction from within the base class itself), any code holding a `clsOnlineContext` never needs to set the application name separately.
- `savecontext` is declared `Shadows` rather than `Overrides` — it does not override a virtual member, it introduces a new public member with the same base name but different casing/accessibility that hides the inherited `Protected Friend SaveContext` from consumers using the derived type's static type.

## Constraints and usage notes
- Because the base class's `ApplicationName` setter is `Friend`, external code cannot reassign the fixed `"Online"` application name on an existing `clsOnlineContext` instance from outside this assembly.

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- SAIF.Presentation.Web.MVC/clsOnlineContext.vb
- SAIF.Presentation.Web.MVC/clsContext.vb
