Skip to content

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).
  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).
  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); then TempData.Clear() (BR-08).
  4. Branch B, same application: WebContext.SaveToTempData(TempData) writes TempData["WebContextId"] = context.ContextId — this is what OP-01 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.

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.**

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