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
Define web services in asp.net.
How can you make sure that web api returns json data only?
What’s the difference between response .redirect and server.transfer?
Is it possible to create web application with both webforms and mvc?
Is global asax mandatory?
What is applicatio domain?
What is viewstate parameter?
Do cookies store passwords?
What is the difference between mvc (model-view-controller) and mvp (model-view-presenter)? : asp.net mvc
Is asp.net and .net same?
Is session stored in browser?
What are the various ways to send content from one page to another?
How can I configure asp.net applications that are running on a remote machine?
Does web services support data reader like pom project?
In early binding will the method invoked on com component will verify it?s existance in the system or not ?