Wednesday, December 30, 2009

HttpModule and HttpHandler

HttpModule has some events which will be execute every time when the request is processed. But HttpHandler is just executed only on the specific URL.

 

HttpModule has the following events.

·         BeginRequest

·         AuthenticateRequest

·         AuthorizeRequest

·         PreRequestHandlerExecute

·         PostRequestHandlerExecute

·         EndRequest.

 

Web.config entry for HttpModule

<httpModules>
               <add name="CustomHttpModule" type=" MyNameSpace. CustomHttpModule, MyAssembly "/>
</httpModules>

 

Web.config entry for HttpHandler.

<system.web>

<httpHandlers>

               <add verb="*" path="*.raj" type="MyNameSpace.CustomHttpHandler, MyAssembly"/>

</httpHandlers>

</system.web>

 

On the current scenario the httphandler will execute only when the URL has the *.raj request.

 

The HttpHandler should be implemented on IHttpHandler, IHttpAsyncHandler interface of dotnet and HttpModule should be implemented on IHttpModule interface.
 

There is 2 interface in dotnet for synchronous and asynchronous calls of handler the IHttpHandler and  IHttpAsyncHandler

No comments:

Post a Comment