In our previous articles in this series we have learned various concepts of HttpHandler and HttpModule in an ASP.NET request and response pipeline. You can read them here.
- HttpHandler and HttpModule in Real Scenario: Getting Started with HttpHandler
- HttpHandler and HttpModule in Real Scenario: Few examples of HttpHandler-1
- Working with Image in HttpHandler
- Working With Header in HttpHandler
- HttpModule in real scenario: Implement simple HttpModule
- HttpModule in Real Scenario: Multiple HttpModule and Communication
- HttpModule in Real Scenario: Events in HttpModules
In this small article we will learn to pass data from a HttpModule to a HttpHandler. Before getting to the example implementation, let’s clearify a few concepts.
- We can implement more than one HttpModule in a request and response pipeline.
- There will be only one HttpHandler for one type of resource.
- HttpModule will execute before HttpHandler.
- If more than one HttpModule is present in the pipeline then they will execute depending on their registration sequence.
- We can write more than one HttpModule and one HttpHandler (for one type resource) in a single .ashx page.
Fine, we have implemented those concepts pragmatically in all our previous articles (I recommend you visit our previous articles if you are not clear about those concepts).
In this article we will learn to pass data from a HttpModule to a HttpHandler. Sometimes it might be necessary to pass some information between a HttpModule and a HttpHandler and in this scenario this article might be a good resources to solve the problem.
We know that an Item[] collection is for a one-time request and response process. In other words the collection value will be retained during a single HttpRequest or HttpResponse message.
And in our scenario, an item[] collection is the best possible solution (at least, I hope; if a better solution exists then please let us know in a comment).
Yes, we will use an Item[] collection to send data from a HttpModule to a HttpHandler. Have a look at the following example.


sreenivasa kPosted Mar 24, 2016, 10:03 PM
excellent
Mahesh DurgamPosted Jan 28, 2014, 4:47 AM
Very nice article buddy