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

# NavigationContext

`NavigationContext` is the only type in this library that reaches a database. On construction it opens an Oracle connection through `clsMSOracleDataLayer` as the `MENU` schema user (environment named by the `MENU_ENVIRONMENT` app setting) and loads the calling user's full set of authorized menu items via `clsMenuAuthorizedItemCollection.GetMenuAuthorizedItems` (owned by `SAIF.Business.Menu`). Every subsequent lookup method answers navigation and page-authorization questions purely against that in-memory, per-user authorized-item set — it never re-queries the database and never performs its own authorization decision beyond "is this item present in the set I already loaded".

## Purpose
- Resolve, at construction time, the complete set of menu items a given user is authorized to see, scoped by application code and visibility.
- Answer "is this page/item authorized for the current user" (`IsMenuItem`, `GetCurrentPage`, `GetCurrentItem`, `GetItem`, `GetItemSeq`) without any further database access.
- Derive the current application code from the request's virtual directory (`ApplicationCodes.ItemByAppPath`) so navigation answers are correctly scoped per hosted application.

## Context
- Namespace: `SAIF.Presentation.Web.Core`
- Assembly/package: `SAIF.Presentation.Web.Core.Infragistics111` (merged into `SAIF.Presentation.Web.Infragistics111.dll` via `SAIF.BOF.Presentation.Web.Infragistics111.nuspec`)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `New(inUser As String)` | `Public Sub New(inUser As String)` | Opens the `MENU`-schema Oracle data layer for the environment named by `MENU_ENVIRONMENT`, normalizes `inUser` (trim, upper-case), and loads that user's full authorized menu-item set into memory. |
| `MenuAuthorizedItems` | `Public ReadOnly Property MenuAuthorizedItems As clsMenuAuthorizedItemCollection` | The in-memory, per-user collection of authorized menu items loaded at construction; the source of truth for every other lookup on this instance. |
| `IsMenuItem(inApplication, inItem)` | `Public Function IsMenuItem(inApplication As String, inItem As String) As Boolean` | Returns `True` only when `inItem` is present in the authorized set for the resolved application code, by resolving the application code via `ApplicationCodes.ItemByAppPath` and calling `MenuAuthorizedItems.FindPage`. |
| `GetCurrentPage()` | `Public Function GetCurrentPage() As clsMenuAuthorizedItem` | Derives the application code and page link from `Request.ApplicationPath`/`Request.RawUrl`, then returns the matching authorized item (`FindPageExact` with `FindPage` fallback), or `Nothing` if the current page is not in the set. |
| `GetCurrentItem(inCategory)` | `Public Function GetCurrentItem(inCategory As String) As clsMenuAuthorizedItem` | Returns the authorized, visible item for the given category on the current page (`ItemExact` then `Item`, both `visibleOnly:=True`), or `Nothing` if none matches. |
| `GetItem(inCategory, inLink, inAnyApp)` | `Public Function GetItem(inCategory As String, inLink As String, Optional inAnyApp As Boolean = False) As clsMenuAuthorizedItem` | Returns the authorized, visible item matching the category and link, optionally searching across all applications (`ItemByCategory`) rather than only the current one, or `Nothing` if none matches. |
| `GetItemSeq(inApplication, inCategory, inPageLink)` | `Public Function GetItemSeq(inApplication As String, inCategory As String, inPageLink As String) As Integer` | Returns the `MenuItemSeqNum` of the matching authorized item, or `0` if the item is not in the authorized set. |

## Behavioral notes
- The user name passed to `New` is normalized (`.Trim.ToUpper`) before being bound as the `:MenuUser` query parameter, but `NavigationContext` never independently verifies that the supplied name matches the current authenticated identity — callers are responsible for passing the correct identity.*
- `ApplicationCodes` is cached in a `Static` (per-app-domain, process-wide) local rather than per-instance, so application-code resolution is shared reference data with no user dimension and carries no cross-user leakage risk.*
- Every lookup method returns `Nothing`/`False`/`0` rather than throwing when the requested item is not authorized; the deny action (e.g. redirect to login) is the responsibility of the calling controller, not this type.

## Constraints and usage notes
- Construction performs a live Oracle round-trip (`clsMSOracleDataLayer` against `MENU_ENVIRONMENT`); callers should treat `New NavigationContext(...)` as an I/O operation, not a cheap in-memory constructor.
- `MENU_ENVIRONMENT` must be present in the hosting application's `<appSettings>`; it is read via `ConfigurationManager.AppSettings.Get` with no null guard, so a missing key produces an unusable environment name at construction time.*

> **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
- `SAIF.Presentation.Web.Core.Infragistics111/NavigationContext.vb`
