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¶
- 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). - On failure:
ThreadAbortExceptionfromResponse.Redirectis caught,ResetAbortis called, andResponse.End()runs inFinally(BR-MVC-012). - If timed out and the caller is external, add an empty
SAIFAUTHcookie and redirect to/OnlineLogin/LoginScreen.aspx, with the same abort handling (BR-MVC-001, BR-MVC-003, BR-MVC-012). - If the query string carries
__SAIFPID, assign it toViewPage.ViewIDso the request rejoins the correct model instance (BR-MVC-008). - Call
SecurityCheck(). - Embeds Establish the security principal (BR-MVC-004, BR-MVC-005).
- If
Session("navdata")is empty, constructNavigationContext(Model.Context.UserID)and cache it in session (BR-MVC-006). - Embeds Load the user's authorized menu, which reads Oracle menu tables through
SAIF.Business.Menu. - Call
RedirectUnauthorizedUsers(). - Embeds Enforce menu-based page authorization (BR-MVC-007).
- Call
Model.Pre_Init()— the model initializes once and loadsclsPreferencesfor the user/application (BR-MVC-016). - On subsequent calls within the same instance: no-op (the
m_Initedguard prevents re-initialization). - Call the overridable
Load()hook so the derived controller can prepare screen state. - If the request has query-string keys, call
ProcessQueryStrings()→HandleQuerystring(QueryString)(derived hook). - If a referrer exists, call
CheckContext(referrer.LocalPath).- Embeds Receive inbound cross-application context (BR-MVC-010, BR-MVC-017).
- If no referrer: no cross-app context processing occurs.
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
RedirectUnauthorizedUsersdenies access,Session("navdata")is cleared, forcing a fresh menu load on the next request.
Related documentation¶
Sources¶
- SAIF.Presentation.Web.MVC/clsControllerBase.vb
- SAIF.Presentation.Web.MVC/ViewPageBase.aspx.vb