---
title: Navigate between applications and views
summary: Redirect the user to a target URL, handing off web context across or within applications.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-09-17
library: SAIF.Framework.Web.Mvc
reference_type: package
operation_id: OP-07
trigger: POST from a view's navigation control
---

# Navigate between applications and views

Redirect the user to a target URL, handing off web context across or within applications. Trigger: POST from a view's navigation control.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-07 |
| **Trigger** | POST from a view's navigation control |
| **Inputs** | `NavigateViewModel.Url`; `Request.UrlReferrer`; `Session.SessionID`; resolved `WebContext` |
| **Outputs** | `RedirectResult` to `model.Url`, or `null` when `model.Url` is null |
| **Primary components** | `WebContextControllerBase.Navigate(NavigateViewModel)` (`[HttpPost]`, virtual); the `Navigate(string url)` overload wraps a URL into the view model |
| **Entry point** | `src/Web.Mvc/Controllers/WebContextControllerBase.cs` |

## Steps

1. `Enforce.ArgumentNotNull(model, "model")` ([BR-01](../business-rules.md#br-01-guarded-arguments-reject-null-or-empty-input)).
2. Derive `sourceApp` from `Request.UrlReferrer.ApplicationName()` and `targetApp` from the second segment of `model.Url` (empty string when `model.Url` is null) ([BR-07](../business-rules.md#br-07-navigation-target-and-source-application-derivation)).
3. Branch A, `sourceApp != targetApp` (cross-application): set context entries `sourceApp`, `sourceView` (empty), `targetApp`, and `targetView` (URL with the `/{targetApp}/` prefix removed); call `webContextService.Save(sourceApp, Session.SessionID, WebContext)` (delegates to [OP-06](op-06-save-a-web-context-remotely.md)); then `TempData.Clear()` ([BR-08](../business-rules.md#br-08-cross-application-navigation-hands-context-over-via-the-remote-service)).
4. Branch B, same application: `WebContext.SaveToTempData(TempData)` writes `TempData["WebContextId"] = context.ContextId` — this is what [OP-01](op-01-resolve-web-context.md) step 2 later consumes.
5. `queryString` is initialized to `""` and never modified (the `cid=` append logic is commented out), so no query parameter is added.
6. Return `Redirect(model.Url + queryString)` when `model.Url` is non-null; otherwise return `null`.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([POST Navigate])
	Guard[Guard model not null]
	Derive[Derive sourceApp/targetApp]
	Dec{sourceApp != targetApp?}
	Cross["Save via WCF service, clear TempData"]
	Same[SaveToTempData]
	Redir[Redirect to model.Url]
	EndNull([Return null])
	Start --> Guard
	Guard --> Derive
	Derive --> Dec
	Dec -->|Yes| Cross
	Dec -->|No| Same
	Cross --> Redir
	Same --> Redir
	Redir --> EndNull
```

## Failure and edge-case behavior

- A null `Request.UrlReferrer` causes `ApplicationName()` to be invoked on null — behavior depends on that extension's null handling in the dependency package.**

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)

> **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.Mvc/Controllers/WebContextControllerBase.cs`
