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¶
Enforce.ArgumentNotNull(model, "model")(BR-01).- Derive
sourceAppfromRequest.UrlReferrer.ApplicationName()andtargetAppfrom the second segment ofmodel.Url(empty string whenmodel.Urlis null) (BR-07). - Branch A,
sourceApp != targetApp(cross-application): set context entriessourceApp,sourceView(empty),targetApp, andtargetView(URL with the/{targetApp}/prefix removed); callwebContextService.Save(sourceApp, Session.SessionID, WebContext)(delegates to OP-06); thenTempData.Clear()(BR-08). - Branch B, same application:
WebContext.SaveToTempData(TempData)writesTempData["WebContextId"] = context.ContextId— this is what OP-01 step 2 later consumes. queryStringis initialized to""and never modified (thecid=append logic is commented out), so no query parameter is added.- Return
Redirect(model.Url + queryString)whenmodel.Urlis non-null; otherwise returnnull.
Process flow¶
The following diagram visualizes this operation's control flow.
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.UrlReferrercausesApplicationName()to be invoked on null — behavior depends on that extension's null handling in the dependency package.**
Related documentation¶
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