Skip to content

Register AuthenticateRequest handler

This operation runs once per module instance, when ASP.NET first initializes clsSecurityModule. Its sole purpose is to attach the module's request-authentication handler to the hosting application's AuthenticateRequest event, which is what makes every subsequent inbound request pass through this library's authentication logic before reaching the application.

Field Value
Operation ID register-authenticate-request-handler
Trigger ASP.NET calls IHttpModule.Init during module initialization.
Inputs context As HttpApplication
Outputs AuthRequest_Handler subscribed to context.AuthenticateRequest
Primary components clsSecurityModule.Init
Entry point SAIF.Framework.SecurityModule\clsSecurityModule.vb

Steps

  1. Receive the hosting HttpApplication instance from the ASP.NET runtime.
  2. Register AddressOf AuthRequest_Handler with context.AuthenticateRequest, so that every future request on this application enters the module's authentication workflow.
  3. Return immediately without storing any additional module state.
  4. On failure: the method contains no local error handling, so any exception raised during registration propagates unchanged to the hosting runtime.
  5. Leave cleanup empty, since Dispose() is implemented as a no-op and the module holds no resources that need releasing.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([ASP.NET initializes module]) --> S1[Receive HttpApplication]
    S1 --> S2[Attach AuthRequest_Handler to AuthenticateRequest]
    S2 --> EndOk([Module ready for request authentication])

Failure and edge-case behavior

  • Dispose() performs no unregistration or cleanup, so the module relies entirely on the hosting ASP.NET runtime for its lifetime management.
  • The method does not guard against duplicate registration; it assumes ASP.NET calls Init exactly once per module instance, which is the standard IHttpModule contract.

Sources

  • SAIF.Framework.SecurityModule\clsSecurityModule.vb