Consuming HttpModule events in Umbraco

Robert Foster · 23 October 2015

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.

Related Articles

06 February 2015

Hibernate your jobs, don't burn out

Often times when stuck on a problem, a good night's sleep will bring the answer to you the instant you look at it again.

Indexing content in complex Umbraco data types
25 September 2018

Indexing content in complex Umbraco data types

The Umbraco CMS is a very flexible and open platform for building an expressive and intuitive Content Editors interface, but sometimes that comes at a price when it comes to indexing the produced content for Lucene/Examine based searching.  A bit like looking for the needle in the haystack. In this article, Rob takes a look at ways to clean that content up while indexing to surface keywords and presentation without any messy artifacts.

Introducing the MemberListView Dashboard
23 June 2014

Introducing the MemberListView Dashboard

The MemberListView for Umbraco 7 provides a management dashboard view for Members allowing for mass Unlock, Suspension or Activation of members.  This is one area in member management that's currently missing from the Umbraco Core, and this package seeks to address that.  The majority of the functionality was hacked together in time for the Codegarden 14 Package Competition and refined to iron out a few of the bugs and complete the missing functionality.