Posted in ASP.NET MVC, Controllers, Models, Routing, Views by BlueCoder on 03/01/2010

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

Shout it

kick it on


9 Responses

Subscribe to comments with RSS.

  1. DotNetShoutout said, on 08/01/2010 at 09:19


    Thank you for submitting this cool story – Trackback from DotNetShoutout…

  2. ASP.NET MVC Archived Buzz, Page 1 said, on 08/01/2010 at 09:56

    […] to Vote[FriendFeed] How ASP.NET MVC WORKS? « MVC# (1/7/2010)Thursday, January 07, 2010 from […]

  3. Zubair Masoodi said, on 08/01/2010 at 20:46

    Thanks for this beautiful story and what a wonderful way to begin with

  4. uberVU - social comments said, on 08/01/2010 at 20:54

    Social comments and analytics for this post…

    This post was mentioned on Twitter by ali62b: How ASP.NET MVC WORKS?:

  5. […] In previous post I summarized how ASP.NET MVC components work together to process request from user and return […]

  6. How ASP.NET MVC WORKS? « MVC# said, on 11/01/2010 at 03:47

    […] How ASP.NET MVC WORKS? « MVC# – […]

  7. Lindsey Aruizu said, on 29/01/2010 at 00:45

    Its really nice, it very instructive for me. What you wrote is great advice any way that you look at it.

  8. sathiyenthira boopathy h said, on 04/03/2010 at 11:19

    Nice Explanation….

  9. vaibhav kothia said, on 06/04/2010 at 08:45

    Thank you for submitting this cool story – vaibhav kotiha from Dhanashree Inc

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: