How ASP.NET MVC WORKS?
Abstract : In this very short article we travel through ASP.NET MVC Request Processing Pipeline from accepting the request by IIS to showing the result view by View Engine.
IIS takes each HTTP request and invokes ASP.NET which in turn invokes UrlRoutingModule which is a registered HTTP module. UrlRoutingModule starts Routing System which lives in System.Web.Routing namespace. Routing system parses the incoming Url and constructs a data structure named Request Context and searches RouteTable entries to find the matching entry and by default invokes MvcRouteHandler passing the Request Context to it. Request Context includes parameters parsed from Url and provides access to Request and Response objects. MvcRouteHandler by default invokes DefaultControllerFactory which follows a naming convention to choose the correct controller class for a given request. Chosen controller invokes the correct action method which in turn returns an ActionResult object. and that’s it! The request is processed and a result returned. Hooray!
In case of ViewResult, action method constructs a ViewData structure and passes it to ViewResult. ViewResult is able to locate and render a particular view template using ViewData. It does so by invoking WebFormViewEngine which uses WebForms ASPX files as view templates.
The great news is every steps above can be customized: you can have your own Controller Factory and any View Engine you comfortable with you even can create your own Route Handler to take control of routing .
summary : To be able to get the best of ASP.NET MVC you should know whats going on behind the scene and how you can change that so in this very short post you get familiar with ASP.NET MVC Request Processing Pipeline and now have a good idea about it you also learned you can change the way MVC behaves by extending each part in your own way. hope this helps.
Further Readings:
In depth: ASP.NET MVC Pipeline
Request Handling Pipeline Poster
Custom Controller Factory in ASP.NET MVC
Custom Routing for ASP.NET MVC
Extending ASP.NET MVC : Replacing the View Engine
Extending ASP.NET MVC – Replacing the View Engine

How ASP.NET MVC WORKS? « MVC#…
Thank you for submitting this cool story – Trackback from DotNetShoutout…
[...] to Vote[FriendFeed] How ASP.NET MVC WORKS? « MVC# (1/7/2010)Thursday, January 07, 2010 from [...]
Thanks for this beautiful story and what a wonderful way to begin with
Social comments and analytics for this post…
This post was mentioned on Twitter by ali62b: How ASP.NET MVC WORKS?: http://wp.me/pJQia-a…
[...] In previous post I summarized how ASP.NET MVC components work together to process request from user and return [...]
[...] How ASP.NET MVC WORKS? « MVC# – [...]
Its really nice, it very instructive for me. What you wrote is great advice any way that you look at it.
Nice Explanation….
Thank you for submitting this cool story – vaibhav kotiha from Dhanashree Inc