Explain asp.net MVC life cycle?

Posted by  Oasge Christiansen
 187  View(s)
Rate this:

Please briefly describe me about the life cycle of asp.net MVC application with example and with an image.

  1. Re: Explain asp.net MVC life cycle?

    The life cycle is described as a series of steps or events used to handle some requests or to change the application state. In the ASP.NET webforms platform features a complex page life cycle. The .NET platforms, like Windows phone apps, have their own application life cycles.

    The MVC has two life cycles −

    • The application life cycle

    • The request life cycle

    Explain asp.net MVC life cycle?

    The Application Life Cycle

    An application life cycle refers to the time, an application process actually begins running IIS until the time it stops. This time is marked by the application start and end events in the startup file of our application.

    The Request Life Cycle

    Request Life Cycle is the sequence of events that happen every time an HTTP request is handled by our application.

    The entry point for every MVC application begins with routing and when the ASP.NET platform has received a request, then it figures out how it should be handled through the URL Routing Module.

    The Modules are .NET components that can hook into the application life cycle and add functionality and the routing module is responsible for matching the incoming URL to routes which we define in our application.

    All routes that have an associated route handler with them and that is the entry point to the MVC framework.

    Explain asp.net MVC life cycle?

    This MVC framework handles converting the route data into a concrete controller that can handle requests and after the controller has been created, the next major step is Action Execution. The component called the action invoker finds and selects an appropriate Action method to invoke the controller.

    After an action result has been prepared, the next stage triggers that is Result Execution. The MVC separates declaring the result from executing the result and if the result is a view type, then the View Engine will be called and it's responsible for finding and rending our view and if the result is not a view, the action result will execute on its own. The Result Execution is what generates an actual response to the original HTTP request.