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

Upload Image Close it
Select File

I am Jalpesh Vadgama a Microsoft MVP for Visual C# and BrainBench Certified ASP.NET Developer having more then 6 years of experience in .NET Technology.
Browse by Tags · View All
BRH 79
#.NET 52
C#.NET 48
ASP.NET 4.0 31
VisualStudio 27

Archive · View All
December 2010 16
July 2011 13
April 2011 13
April 2012 12
January 2011 12
June 2011 11
May 2011 11
May 2012 8
February 2013 7
January 2013 7

HTTP Module in detail

Jan 13 2011 1:44PM by Jalpesh   

I know this post may sound like very beginner level. But I have already posted two topics regarding HTTP Handler and HTTP module and this will explain how http module works in the system. I have already posted What is the difference between HttpModule and HTTPHandler here. Same way I have posted about an HTTP Handler example here as people are still confused with it. In this post I am going to explain about HTTP Module in detail.

What is HTTP Module

As we all know that when ASP.NET Runtimes receives any request it will execute a series of HTTP Pipeline extensible objects. HTTP Module and HTTP handler play important role in extending this HTTP Pipelines. HTTP Module are classes that will pre and post process request as they pass into HTTP Pipelines.  So It’s one kind of filter we can say which will do some procession on begin request and end request.

If we have to create HTTP Module we have to implement System.Web.IHttpModule interface in our custom class. An IHTTP Module contains two method dispose where you can write your clean up code and another is Init where your can write your custom code to handle request. Here you can your event handler that will execute at the time of begin request and end request.

Let’s create an HTTP Module which will just print text in browser with every request. Here is the code for that.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Experiment
    public class MyHttpModule:IHttpModule
        public void Dispose()
            //add clean up code here if required

        public void Init(HttpApplication context)
            context.BeginRequest+=new EventHandler(context_BeginRequest);
            context.EndRequest+=new EventHandler(context_EndRequest);  

        public void context_BeginRequest(object o, EventArgs args)
            HttpApplication app = (HttpApplication)o;
            if (app != null)
                app.Response.Write("<h1>Begin Request Executed</h1>");
        public void context_EndRequest(object o, EventArgs args)
            HttpApplication app = (HttpApplication)o;
            if (app != null)
                app.Response.Write("<h1>End Request Executed</h1>");

Here in above code you can see that I have created two event handler context_Beginrequest and context_EndRequest which will execute at begin request and end request when request are processed. In this event handler I have just written a code to print text on browser.

Now In order enable this HTTP Module in HTTP pipeline we have to put a settings in web.config  HTTPModules section to tell which HTTPModule is enabled. Below is code for HTTPModule.

        <compilation debug="true" targetFramework="4.0" />
        <add name="MyHttpModule" type="Experiment.MyHttpModule,Experiment"/>

Now I just have created a sample webform with following code in HTML like following.

<form id="form1" runat="server">
    <B>test of HTTP Module</B>

Now let’s run this web form in browser and you can see here it the output as expected.


Shout it

Tags: BRH, #DOTNET, #ASP.NET, ASP.NET, #.NET, ASP.NET 4.0, Request, Response,

15 · 11% · 3548


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]