Saturday, April 25, 2020

ASP.NET MVC Architecture


Asp.net MVC introduced in .Net Version 3.5 in 2009 with good features like MVC architecture, Ajax Helpers, HTML Helpers, etc.  Asp.net MVC is a complete alternative to ASP.NET WebForms. It builds on ASP.NET so you can get all features of asp.net while developing MVC applications. It is basically a Web development Framework from Microsoft. It is a lightweight and highly testable presentation Framework. 

Let’s understand the MVC Architecture


MVC pattern stands for Model, View, and Controller.  MVC pattern is used SAC (Separation Application Concern), It splits the application into 3 components that are Model, View, and Controller.


Model: Model represents an object and maintains the application data and Business logic.

Controllerit controls both View and Model. It takes the appropriate user input requests coming from the browser and renders the appropriate View with Modal Data.

ViewView is a User Interface of application that contains the data or Modal Data.


How Request Goes to Server and Response Back It?


  1. When the user enters the URL in the Internet Explorer(IE) / Chrome/ Mozilla Firefox or any other browser.    
  2.  The first request goes to the server and fires the Register Routes. Before that, we need to register the “Register Routes” in Application_Start Event in Global.asax file
  3.  Controller Render the view to the browser with model data.
  4.   “Register Routes” is a Static method in RouteConfig Class in App_Start Folder. In RouteConfig Class, we can find the parameters like NAME, URL, DEFAULT. Based on that parameter Route Engine selects the controller, action methods and executes the next step goes to Controller.
  5. The controller communicates with Model-based on request. And maintaining the business Logic and Model Data


No comments: