Get Started!

HTTP Modules

A HTTP Module will allow you to pass every request through some common server logic, to say stamp a custom header, rewrite the response, etc.

Unlike the HTTP Handlers, which are bound to certain requested URL patterns and only execute if they match, HTTP Modules will capture every request.

Performance

As they execute on every request, performance should be a primary concideration. Typically, caches with HashMaps, Dictionaries and in-memory Data Collections are used to gain maximum performace, along with ending / returning from the main stack as soon as possible.

Register Module with DynAssDelegateModule.RegisterAction

The DynAssDelegateModule.RegisterAction method recives a string used as a key for the specific module and an Action<HttpApplication>, containng the main body of the module.

Signature

DynAssDelegateModule.RegisterAction(
  string key,
  Action<HttpApplication> action
)

Usage

DynAssDelegateModule.RegisterAction(

  // Key / Ident for Module
  @"module-key",

  // The main thread for the module
  (httpApp) => {

    // Do Somthing...
  }

);

Examples

Adding a Custom Header -

  • Stamping the Headers with X-Hello: World

Rewrite or Redirect Old Site Links -

  • Using HTTP Modules to Redirect & Rewite Urls