/o:p>/span>/p>
This event is raised when the Authentication is about to begin. This event can
be used to override the default authentication and write a completely new
custom authentication process. We can use this during the development phase to
quickly override the base authentication mechanism. During production phase,
simply remove this event code./p>
Event:
Application_OnAuthorizeRequest/span>/o:p>/span>/p>
This event is raised when the Authorizations is about to
begin. We can customize the default authorization here to write our own custom
authorization process. . We can use this during the development phase to
quickly override the base Authorizations mechanism. During production phase,
simply remove this event code./p>
Event:
Application_OnResolveRequestCache/span>/o:p>/span>/p>
This event is used in Page Caching. Page caching serves
similar request from the cache.ASP.NET uses this event to run the page code or
to use the page cache instead. We can override this event to customize the page
caching. It also let you write code for every request whether the page was
delivered from the cache or from the aspx page (code for performance log for
page views can be written here)./o:p>/span>/p>
Event:
Application_OnAcquireRequestState/span>/o:p>/span>/p>
This event fires when the session state is about to be
populated for the request. This event can be used for customization of session
state. This event can be handled by the web page or service but its best to
centralize the code that we might write in the page level event./o:p>/span>/p>
Event:
Application_OnPreRequestHandlerExecute/span>/o:p>/span>/p>
This event is raised just before the page handler or the web
service handler takes over. This event can be used if you need to perform some
action before handing over the request to the page./o:p>/span>/p>
Event Related to the response are listed below in their
respective order./o:p>/span>/p>
Event:
Application_OnUpdateRequestCache/span>/o:p>/span>/p>
When ASP.Net engine decides to update the page cache this
event is raised. We can write some custom code to monitor the performance time
in which the cache is refreshed./o:p>/span>/p>
Event:
Application_OnReleaseRequestState/span>/o:p>/span>/p>
This event occurs when the session data is released. We can
handle the custom objects created in the OnRequestState here./p>
Event:
Application_OnPostRequestHandlerExecute/span>/o:p>/span>/p>
This event is raised when the default handler finishes the
execution. This can be used to create custom Header and Body./o:p>/span>/p>
Event:
Application_OnEndRequest/span>/o:p>/span>/p>
This is the last event to be fired in the ASP.NET Pipeline.
Clean up are best done here. If we want to add something to all the pages we
can do it here./o:p>/span>/p>
Event:
PreSendRequestHeaders/span> /o:p>/span>/p>
These events are fired when the entire Header is ready to be
sent to the client response. These prevent are fired when the HTTP Headers are
sent. Change any content should be done before this event fires otherwise wrong
size information would be sent in the header./o:p>/span>/p>
Event:
PreSendRequestContent/span>/o:p>/span>/p>
This event is fired when the entire body text is sent to the
client./o:p>/span>/p>
There are a few other events, which occurs conditionally.
These events are/span>/o:p>/span>/p>
Event:
Application_OnStart/span>/o:p>/span>/p>
This event takes place when the application starts.
Application variable can be set here. Basically all the tasks that are to be
done only once can be done here. We can also code here to capture the number of
time application starts (for logging purpose) although I would recommended to
use the Health Monitoring
API/span>/a>./o:p>/span>/p>
Event:
Application_OnEnd/span>/o:p>/span>/p>
This event occurs when the application is ending. This event
is generally used to clean up the things that were used during application
execution./o:p>/span>/p>
Event:
Session_OnStart/span>/o:p>/span>/p>
Fires when a new session begins. Used to set session value
for each user and caching Item based upon the user context./o:p>/span>/p>
Event:
Session_OnEnd/span>/o:p>/span>/p>
This event fires when the session ends [Note: This event
fires only when session is stored IN-Proc and not when the session is stored
out of process]. This event is generally used for session specific clean-up,
usage statistics for each session, log of the reason of termination of the
state etc./o:p>/span>/p>
Event:
Application_Error/span>/o:p>/span>/p>
This event occurs when unhandled error occurs. Logging of
errors, Notifying Administrator of the error, taking global action in case of
error, showing user a user-friendly page in case of an error etc can be done in
this event. /o:p>/span>/p>
Event:
Application_OnDisposed/span>/o:p>/span>/p>
This event takes place when the CLR removes the application
from the memory. This event can be used for some more clean-up procedures./o:p>/span>/p>
Event:
CompleteRequest method/span>/o:p>/span>/p>
This event is used to bypass normal processing of the HTTP
requests. If you handle some event with custom code and do not want the
procession to go pass to further default event handlers in the request chain
then use this method. When this request is called it ignores the other entire
handlers and calls EndRequest event./o:p>/span>/p>
All the custom code for overriding the Application events
is written Global.asax. This file is optional. But if you need to customize the
application event management logic, and session event management logic you need
to create this and write code in it.
Thanks
Vikram
/span>