Skip to content

Initialize a request

Every derived .aspx page runs this operation once per request, before any page-specific logic executes. It is the fixed sequence that turns a raw HTTP request into an authenticated, authorized, model-backed screen: session-timeout handling, security establishment, menu-based page authorization, model initialization, and query-string/cross-application context processing.

Field Value
Operation ID OP-MVC-01
Trigger ViewPageBase.Page_Init (or ViewControlBase.Page_Init) after the factory produces the controller
Inputs HttpContext.Current (session, request, query string, referrer), session keys navdata, <ViewID>-model, <ViewID>-viewdata
Outputs Established security principal, cached NavigationContext, initialized model, applied query string and inbound context; possibly a redirect
Primary components clsControllerBase.Initialize
Entry point SAIF.Presentation.Web.MVC/clsControllerBase.vb

Steps

  1. Check IsSessionTimedOut — a postback arriving on a new session. If timed out and the caller is internal (IsInsideClient), redirect to /<ApplicationName>?MSG=Your session has timed out. (BR-MVC-001, BR-MVC-002).
  2. On failure: ThreadAbortException from Response.Redirect is caught, ResetAbort is called, and Response.End() runs in Finally (BR-MVC-012).
  3. If timed out and the caller is external, add an empty SAIFAUTH cookie and redirect to /OnlineLogin/LoginScreen.aspx, with the same abort handling (BR-MVC-001, BR-MVC-003, BR-MVC-012).
  4. If the query string carries __SAIFPID, assign it to ViewPage.ViewID so the request rejoins the correct model instance (BR-MVC-008).
  5. Call SecurityCheck().
  6. Embeds Establish the security principal (BR-MVC-004, BR-MVC-005).
  7. If Session("navdata") is empty, construct NavigationContext(Model.Context.UserID) and cache it in session (BR-MVC-006).
  8. Embeds Load the user's authorized menu, which reads Oracle menu tables through SAIF.Business.Menu.
  9. Call RedirectUnauthorizedUsers().
  10. Embeds Enforce menu-based page authorization (BR-MVC-007).
  11. Call Model.Pre_Init() — the model initializes once and loads clsPreferences for the user/application (BR-MVC-016).
  12. On subsequent calls within the same instance: no-op (the m_Inited guard prevents re-initialization).
  13. Call the overridable Load() hook so the derived controller can prepare screen state.
  14. If the request has query-string keys, call ProcessQueryStrings() → HandleQuerystring(QueryString) (derived hook).
  15. If a referrer exists, call CheckContext(referrer.LocalPath).

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Page_Init]) --> S1{IsSessionTimedOut?}
    S1 -->|internal| S2([Redirect: app landing page])
    S1 -->|external| S3([Clear SAIFAUTH, redirect login])
    S1 -->|no| S4[SecurityCheck]
    S4 --> S5{Session navdata empty?}
    S5 -->|yes| S6[Load NavigationContext]
    S5 -->|no| S7[RedirectUnauthorizedUsers]
    S6 --> S7
    S7 --> D{Authorized?}
    D -->|No| EndErr([Redirect to login screen])
    D -->|Yes| S8[Model.Pre_Init + Load]
    S8 --> S9[Process query strings]
    S9 --> S10[CheckContext if referrer present]
    S10 --> EndOk([Continue to page lifecycle])

Failure and edge-case behavior

  • A session that appears timed out is never processed further in the current request — the pipeline stops at step 1/2 with a redirect.
  • If RedirectUnauthorizedUsers denies access, Session("navdata") is cleared, forcing a fresh menu load on the next request.

Sources

  • SAIF.Presentation.Web.MVC/clsControllerBase.vb
  • SAIF.Presentation.Web.MVC/ViewPageBase.aspx.vb