Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Abhijit works at Microsoft as a .NET Consultant. He is a former Microsoft ASP.NET MVP, Code Project MVP and a Microsoft Certified Technology Specialist on Web Development.
Browse by Tags · View All
BRH 18
ASP.NET 17
.NET 15
#ASP.NET 10
#DOTNET 10
Visual Studio 10
.NET 4.0 6
ASP.NET 4.0 5
VS2010 5
Visual Studio 2010 4

Archive · View All
April 2011 8
May 2011 4
March 2011 4
June 2011 3
February 2011 1

How to retrieve HTTPModule details from HttpModuleCollection ?

May 23 2011 1:00AM by Abhijit Jana   

In one of my previous post I have talked about How to get list of all active HttpModules in ASP.NET? Where I have explained how we can get list of all active modules of an ASP.NET Application at runtime. In this post, I am going discussed about, how you can get details of a particular module details from list of modules.

when a request reaches to worker Process from client browser, first of all Worker process is responsible to start HttpRuntime by loading ISAPI filter. After that HttpRuntime load an HttpApplication object with the help of  HttpApplicationFactory class. Each and every request should pass through the corresponding HTTPModule to reach to HTTPHandler, this list of module are configured by the HTTPApplication.  HttpContext.Current.ApplicationInstance will give us the   HTTPApplication object for current Request. This HTTPApplication object  contains the list of modules.

          //Get Application Instance from Current Content
            HttpApplication httpApps = HttpContext.Current.ApplicationInstance;
            //Get List of modules in module collections
            HttpModuleCollection httpModuleCollections = httpApps.Modules;

Now we run the below code block, we will get list of all active modules,

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

List of Modules Output :

image

Now, if you want to get details of any HTTPModule, you have to use httpModuleCollections.Get(“<ModuleName>”). This will return you IHttpModule Object. Now from the return object you can get details of that module.

Let’s consider, if you want to get details of “Session” module, you have to write below code block.

IHttpModule sessionModule = httpModuleCollections.Get("Session");

If you try to inspect the sessionModule  object in Quick Watch window, you will get all the details related with Session Module

image

httpModuleCollections.Get() will also help you to get details of any of your custom module, moreover if you want to call any method from your Custom HTTPModule you have to use the same approach.

IHttpModule customModule = httpModuleCollections.Get("MyCustomModule");
ICustomModule myCustomModule = (ICustomModule)customModule;
string result = myCustomModule.ModuleMethod()

Hope this will help !

Cheers !!

AJ


Filed under: .NET 4.0, ASP.NET 4.0, General

Tags: #DOTNET, #ASP.NET, ASP.NET, .NET, BRH, ASP.NET 4.0, .NET 4.0, C#, HttpModule, Request, General, Tips, HttpApplication,


Abhijit Jana
122 · 1% · 422
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]