Wednesday, May 18, 2011

Basics of ASP.NET MVC

If you are developing web applications using ASP.NET, I am sure every one must have gone through this thing called ASP.NET MVC. So for a beginner or even for myself to keep some things remembered about ASP.NET MVC, thought to write this post.

The ASP.NET MVC Framework is a web application framework which is used to develop web applications in Model-View-Controller design pattern (I will briefly describe about the MVC pattern latter in this post). Actully ASP.NET MVC Framework is a part of the ASP.NET Web application framework which comes under Microsoft .NET framework.

There are exactly two different programming models which can be used to create ASP.NET Web Applications. One is ASP.NET MVC and the other is ASP.NET Web Forms. Since in here we are mainly focusing on ASP.NET MVC, we'll move forward with that.

First of all to get a whole imaginary idea of MVC, take a good look at the following image.

ASP.NET MVC
In ASP.NET MVC everything is handled by the above 3 main components which are Model, View and Controller. Let's start with the Model component.

  1. Model Component
    • Model represent the data or activity corresponding to the application. Simply means it represents the state of the application. (Ex: DB)
  2. View Component
    • A View is responsible for rendering a user interface to display information which it accepts from Controller Component. (Ex: Web Pages)
  3. Controller Component
    • A controller handles interactions and then updates the model to reflect a change in state of the application, and then passes information to the View. (Ex: Web Services)
When creating ASP.NET MVC Web Applications, the namespace that contains classes and interfaces that supports the ASP.NET MVC is System.Web.Mvc.

Hope you get something out of this post. Appreciate your feedback.

Happy Coding.

Regards,
Jaliya


No comments:

Post a Comment