ASP.NET MVC Pipeline life-cycle Part 2

Beginner

2019-04-10

ASP.NET MVC Tutorials Part 2

In The previous tutorial : ASP.NET MVC Pipeline life-cycle Part 1 We talked about how the application initializes and receives the HTTP Request then how it does the Routing and we saw MapRoute function

In this tutorial we will continue with rest of MVC pipeline life-cycle

ASP.NET MVC Pipeline


  • Controller

    • After the HTTP handler receives the request from the routing module
    • the controller factory will take the responsibility to create a new instance of the required controller
    • the dependency resolving process is run if it is needed
    • the Controller.Execute function is called

Controller Execution


  • Authentication and Authorization Filters

    • MVC Authentication filters are components that authenticate the HTTP request
    • Authentication filters let you set an authentication scheme for individual controllers or actions. That way, your app can support different authentication mechanisms for different HTTP resources.
    • filters can be applied both on controller level and action level
    • below is an example of authentication filter applied on controller level




  • Action Execution

    • The Action is located and invoked
    • Action Filters are applied
    • If the filters pass, the action is executed
    • The Action Result is passed back to the result execution


MVC Action Execution

  • Result Execution

    • If the result needs to be passed to the view engine it’s passed to it otherwise it is returned back
    • view engine is being initialized
    • access and render HTML and validation rules using HTML helper
    • the result is sent back to the client

Conclusion :

we have seen a brief introduction about ASP.NET MVC Pipeline life-cycle with some code snippets to explain the concepts. we will study these components in details and see how to utilize them.