Enumerating HttpModules
Posted August 24, 2008
Reading time: 1 minute
One common ASP.NET performance tip is to remove any HttpModule
s that your application does not use. You can take a peek at which modules are loaded by the framework on your behalf by examining the framework’s Web.config
file, but how do you find out which modules are actually loaded in the current context?
Fortunately, the HttpApplication instance provides a Modules collection that you can loop through:
|
|
You can then use the Modules collection create a table like this:
And boom, there you have it: a list of HttpModule
s that are loaded for the current context. You can use this information to determine which HttpModule
s are needed by your application, and which ones you can safely remove.