I recently saw a question about consuming events from NWebSec's HttpHeaderSecurityModule in Umbraco.  The inquirer was attempting to wire it up in Global.asax.cs as per the documentation, but Umbraco overrides the Global.asax.cs so it wasn't working for him.

Umbraco provides the ApplicationEventHandler class to derive from when connecting to events in modules and the Umbraco Services, but it's not immediately obvious for HttpModules that don't have static events.

If you're implementing a custom IHttpModule or including a third party Module like NWebSec, here's one way to connect up to any events exposed by your module:


Here we're using the umbracoApplication parameter to gain access to the list of registered Modules - this way we can connect to our desired module's Event handlers.

Share this article... Twitter Facebook LinkedIn

Keep Reading