Getting the List of All running active HttpModules.

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 488
Note:- We can get the list of all HttpModules which are currently running,from the web.config or from machine.config file.
//Get Application Instance from Current Content
HttpApplication http_apps = HttpContext.Current.ApplicationInstance;

//Get List of modules in module collections
HttpModuleCollection http_module_collections = http_apps.Modules;
Response.Write("Active HttpModule Count : " + http_module_collections.Count.ToString() + "</br>");
Response.Write("<b>List of Active Modules</b>" + "</br>");

foreach (string active_module in http_module_collections.AllKeys)
{
Response.Write(active_module + "</br>");
}

Output:-
Active HttpModule Count : 11
List of Active Modules:-
OutputCache
Session
WindowsAuthentication
FormsAuthentication
DefaultAuthentication
RoleManager
UrlAuthorization
FileAuthorization
AnonymousIdentification
Profile
UrlMappingsModule

Comments or Responses

Login to post response