what are Httpmodule and HttpHandler?

Answer Posted / sarat

HTTP Handler :

HTTP handlers are the .NET components that implement the
System.Web.IHttpHandler interface. Any class that implements
the IHttpHandler interface can act as a target for the
incoming HTTP requests. HTTP handlers are somewhat similar
to ISAPI extensions. One difference between HTTP handlers
and ISAPI extensions is that HTTP handlers can be called
directly by using their file name in the URL.

HTTP handlers implement the following methods:
ProcessRequest - This method is actually the heart of all
http handlers.
IsReusable - This property is called to determine whether
this instance of http handler can be reused for fulfilling
another request of the same type. HTTP handlers can return
either true or false in order to specify whether they can be
reused.

We can use <httpHandlers> and <add> nodes for adding HTTP
handlers to our Web applications. In fact the handlers are
listed with <add> nodes in between <httpHandlers> and
</httpHandlers> nodes.
Ex: <httpHandlers>
<add verb="supported http verbs" path="path"
type="namespace.classname, assemblyname" />
<httpHandlers>
(In this verb=GET/POST/HEAD path=path for
incoming HTTP requests type=…)



HTTP Module :

Http modules are called before and after the http handler
executes. Http modules enable developers to participate in,
or modify each individual request. Http modules implement
the IHttpModule interface, which is located in the
System.Web namespace.

Available Events: BeginRequest, AuthenticateRequest,
AuthorizeRequest, EndRequest, etc.
Configuring HTTP Modules: In web.config
Ex: <system.web>
<httpModules>
<add name="MyModule"
type="MyModule.SyncModule, MyModule" />
</httpModules>
</system.web>
Creating HTTP Modules: To create an HTTP module, you must
implement the IHttpModule interface, The IHttpModule
interface has two methods with the following signatures:
void Init(HttpApplication);
void Dispose();

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different types of Caching techniques in ASP.NET?

569


What is the difference between application state and session state in asp net?

503


How information about the user's locale can be accessed?

581


If Instancing = Single use for ActiveX Exe, how will this be executed if there are 2 consecutive client requests ?

1967


Explain the concept of View Model in MVC?

589






Do you know caching feature?

560


what is AutoEventWireUp and what is the use of This property explain in details?

1126


What is a session http?

519


What is a session in programming?

554


Explain client side state management system.

562


What do you mean by caching in asp.net?

547


What are the various types of cookies in asp.net?

538


1.what is the application pool. 2.what is the HttpModile and Http Handler. 3.C# 3.0 Features ? 4.Anonoymous Type,methopd and claas in 3.0? 5.difference between statsic and const ? 6.session vs application 7.state management clint side and server side ? 8.Genric list 9.c# 3.0 vs 3.5

1756


Explain the differences between managed and unmanaged code?

498


Define a web service in .net?

611