17 April 2014

Execution Flow MVC Request -- MVC(Model View Controller)

   Request Flow handles the request from the user (client) and send it to the server. Let’s look into details on the function flow internally when client raises a request. This is what happens when u type an asp .net MVC application URL into the address bar of a web browser & clicks on enter. 

Request -->Routing --> Handler -->Controller --> Action --> View --> Response 



Detailed Steps the Request Flow
  • Request comes into ASP.net
  • Asp.net Routing finds the route match by calling RouteCollection.GetRouteData
  • This is turn calls RouteNase.GetRouteData on each route until it finds a match
  • The IRouteHandler for the matching route has its GetHttpHandler method called
  • The MVCHandler runs (ProcessRequest is called)
  • The MVC controller factory locates and creates the controller in CreateController
  • The ControllerActionInvoker determines which action to run in InvokeAction
  • The Authorization Filter stage Executes (this includes the authorization method on controller itself)
  • The Action executing stage executes
  • The requested action method is executed
  • The action Executed stage executes
  • If there is a result object then the result executing stage Executes
  • If the result wasn’t cancelled then the action result’s ExecuteResult method is executed
  • The Result Executed stage executes
  • If an Error occurred then the exception stage executes

No comments:

Post a Comment