In this blog, I want to discuss the request life cycle events and the importance of each event in a ASP.NET MVC application. The following requests are fired every time a request is made.
- PreRequestHandlerExecute Event : This event occurs before the HTTP handler is executed.
- PostRequestHandlerExecute: This event occurs after the HTTP handler is executed.
In between these two events MVC generates response.
This event writes output back to the Output cache.
This event occurs just before ASP.NET performs any logging for the current request.
This event occurs as the last event in the HTTP pipeline chain of execution when ASP.NET responds to a request.
The first event in the HTTP pipeline chain of execution when ASP.NET responds to a request
The AuthenticateRequest event ensures that the request will be authenticated before processing the attached module or event handler.
The AuthorizeRequest event ensures that the request will be authenticated and authorized before processing the attached module or event handler.
This event determines if a page can be served from the Output cache. If you want to write your own caching module (for example, build a file-based cache rather than a memory cache), synchronize this event to determine whether to serve the page from the cache.
The MapRequestHandler is introduced in the .NET Framework version 3.5.The event is used by the ASP.NET infrastructure to determine the request handler for the current request. But some versions of IIS do not support this event.
This event occurs when ASP.NET acquires the current state for example, retrieve Session state from the state store.
This event occurs after ASP.NET finishes executing all request event handlers. This event causes state modules to save the current state data.Session state is stored back in the state store.
Latest posts by Tom Mohan (see all)
- How to choose a WCF binding ? - January 29, 2017
- Get free Azure trial worth ₹50,000 and Azure webinar series . - September 3, 2016
- .NET core : Build and run in any platform. - August 7, 2016