Tuesday, April 13, 2010

Handlers Module

HttpContext
- Request
- Response

HttpApplication
- maintaining application-scope methods
- data
- events
- After the HttpApplication object massages the request, it pushes the request through one or more HttpModule objects.

HttpModule

- When an HttpModule is hooked into the pipeline (via an entry in web.config), the ASP.NET runtime calls the module's Init and Dispose methods.
- Init is called when the module attaches itself to the HttpApplication object
- Dispose is called when the module is detached from HttpApplication.
































































Event

Occurs

AcquireRequestState

When ASP.NET acquires the current state (for example, session state) associated
with the current request

AuthenticateRequest

When a security module has established the identity of the user

AuthorizeRequest

When a security module has verified user authorization

BeginRequest

When the first event in the HTTP pipeline chain of execution responds to a request

Disposed

When ASP.NET completes the chain of execution when responding to a request

EndRequest

When the last event in the HTTP pipeline chain of execution responds to a request

Error

When an unhandled exception is thrown

PostRequestHandlerExecute

When the ASP.NET handler (page, XML Web Service) finishes execution

PreRequestHandlerExecute

Just before ASP.NET begins executing a handler such as a page or XML Web Service

PreSendRequestContent

Just before ASP.NET sends content to the client

PreSendRequestHeaders

Just before ASP.NET sends HTTP headers to the client

ReleaseRequestState

After ASP.NET finishes executing all request handlers; also causes state modules
to save the current state data

ResolveRequestCache

When ASP.NET completes an authorization event to let the caching modules serve requests
from the cache, bypassing execution of the handler (the page or XML Web Service,
for example)

UpdateRequestCache

When ASP.NET finishes executing a handler in order to let caching modules store
responses that will be used to serve subsequent requests from the cache


<httpmodules>
<add name="MyHttpModule" type="name of the class which implement the interface IHttpModule, path where the class is present, Culture=neutral">

<httpmodules>
<add type="[Namespace.]SeoUrls, [AssemblyName], [Version=x.x.x.x, Culture=neutral, PublicKeyToken=933d439bb833333a]" name="SeoUrls">
</add>

<httpmodules>
<add name="MyHttpModule" type="Secure, App_Code, Culture=neutral">
</add>


<httphandlers>
<add verb="*" path="*.data" type="namespace.classname, assemblyname(I.E. DLL Name)">

<add verb="*" path="xyz.aspx" type="test.MyFactory,HandlerFactoryTest">
</add>

</add></httphandlers></httpmodules></httpmodules></add></httpmodules>

No comments: