Traditionally there has been only one approach to develop ASP.NET web applications; web forms. Lately I’ve been hearing a lot of hype wrapped around this thing called MVC and the fact that it can be used as an approach to develop ASP.NET applications. What is MVC? MVC stands for Model-View-Controller. It is a design pattern which separates an application into 3 logical tiers: domain, input, and presentation. This isolation between layers yields independent development, testing, and maintenance of each.
Model – The model can be thought of as the business layer. It performs application logic and is used to maintain the state of the application typically in a database.
View – A view is a component that is used to display the UI which can often be a direct representation of the model’s state. For an example, the model may return a collection of workers from the database. The View could display the workers in a GridView/DataGrid.
Controller – The controller ultimately handles and responds to user interaction. It works with the model based on what the user desires and then renders the appropriate view accordingly.
The ASP.NET MVC Framework is Microsoft’s stab at at creating an ASP.NET programming environment that is centered around the MVC pattern. So how is the request model different between MVC and traditional web forms? An ASP.NET web form uses the postback to relay the request and the page’s code behind handles it. In ASP.NET MVC, REST is used to communicate the request and MVC is used to process it.
REST stands for Representational State Transfer. In ASP.NET MVC, instead of mapping URLs to ASPX files stored on disk you are mapping URLs to controllers (classes). The controller will handle what view to render back to the end-user.
ASP.NET MVC Overview Part 1 (General ASP.NET MVC Overview)
ASP.NET MVC Overview Part 2 (Advantages of MVC and Web Forms)
ASP.NET MVC First Impressions