I am trying to find a way to programmatically check if any particular HttpModule is loaded (since the component I'm writing requires the module to work correctly). I'm trying to:
bool ismodulepresent = false; foreach(HttpModuleAction module in ((HttpModulesSection)ConfigurationManager.GetSection("system.web/httpModules")).Modules) { if(module.Type == typeof(MyModule).FullName) { ismodulepresent = true; break; } }
But this only works for the IIS5.1 <httpModules> section, and not for the new <system.webServer> section.
Any idea if there is a better way to do this other than just checking both sections?
Kieran benton
source share