Click here to Skip to main content
15,498,622 members
Articles / .NET
Posted 26 Jan 2010

Tagged as


236 bookmarked

Understanding ASP.NET MVC (Model View Controller) Architecture for Beginners

Rate me:
Please Sign up or sign in to vote.
4.46/5 (161 votes)
14 May 2012CPOL3 min read
Learning ASP.NET MVC (Model View Controller) architecture and fundamentals for beginners


This article is intended to provide basic concepts and fundamentals of ASP.NET MVC (Model View Controller) architecture workflow for beginners.

“M” “V” “C” stands for “MODEL” “VIEW” “CONTROLLER”. ASP.NET MVC is an architecture to develop ASP.NET web applications in a different manner than the traditional ASP.NET web development. Web applications developed with ASP.NET MVC are even more SEO (Search Engine) friendly.

Developing ASP.NET MVC application requires Microsoft .NET Framework 3.5 or higher.

MVC Interaction with Browser

Like a normal web server interaction, MVC application also accepts requests and responds to the web browser in the same way.

Inside MVC Architecture

The entire ASP.NET MVC architecture is based on Microsoft .NET Framework 3.5 and in addition uses LINQ to SQL Server.

What is a Model?

  1. MVC model is basically a C# or VB.NET class
  2. A model is accessible by both controller and view
  3. A model can be used to pass data from Controller to view
  4. A view can use model to display data in page.

What is a View?

  1. View is an ASPX page without having a code behind file
  2. All page specific HTML generation and formatting can be done inside view
  3. One can use Inline code (server tags ) to develop dynamic pages
  4. A request to view (ASPX page) can be made only from a controller’s action method

What is a Controller?

  1. Controller is basically a C# or VB.NET class which inherits system.mvc.controller
  2. Controller is a heart of the entire MVC architecture
  3. Inside Controller’s class action methods can be implemented which are responsible for responding to browser OR calling views.
  4. Controller can access and use model class to pass data to views
  5. Controller uses ViewData to pass any data to view

MVC File Structure & File Naming Standards

MVC uses a standard directory structure and file naming standards which are a very important part of MVC application development.

Inside the ROOT directory of the application, there must be 3 directories each for model, view and Controller.

Apart from 3 directories, there must have a Global.asax file in root folder, and a web.config like a traditional ASP.NET application.

  • Root [directory]
    • Controller [directory]
      • Controller CS files
    • Models [directory]
      • Model CS files
    • Views [directory]
      • View aspx/ascx files
    • Global.asax
    • Web.config

ASP.NET MVC Execution Life Cycle

Here is how MVC architecture executes the requests to browser and objects interactions with each other.

A step by step process is explained below [Refer to the figure as given below]:

Browser Request (Step 1)

Browser request happens with a specific URL. Let’s assume that the user enters URL like: []/home/index/

Job of Global.asax – MVC routing (Step 2)

The specified URL will first get parsed via application_start() method inside Global.asax file. From the requested URL, it will parse the Controller, Action and ID.

So for []/home/index/:

  • Controller = home
  • Action = index()
  • ID = empty — we have not specified ID in []/home/index/, so it will consider as empty string

Controller and Action methods (Step 3)

MVC now finds the home controller class in controller directory. A controller class contains different action methods,

There can be more than one action method, but MVC will only invoke the action method which has been parsed from the URL, its index() in our case.

So something like: homeController.index() will happen inside MVC controller class.

Invoking action method can return plain text string OR rendered HTML by using view.

Call to View (Step 4)

Invoking view will return view(). A call to view will access the particular ASPX page inside the view directory and generate the rendered HTML from the ASPX and will respond back to the browser.

In our case, controller was home and action was index(). So calling view() will return a rendered HTML from the ASPX page located at /views/home/index.aspx.

This is it, the whole process ends here. So this is how MVC architecture works.


  • 26th January, 2010: Initial post


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Written By
Software Developer (Senior) Gateway Technolabs Pvt. Ltd
India India
Having 4+ years of Technical Experience in,, SQL Server 2008,AJAX, XML,JQuery, JavaScript, .net framework, WCF, WPF/Silverlight,SSIS, SSRS, MVC.

While not working loves Photography and bike riding. Playing computer games are the best stress buster for him Smile | :)

Comments and Discussions

GeneralMy vote of 3 Pin
Member 395592710-May-11 1:21
MemberMember 395592710-May-11 1:21 
GeneralRe: My vote of 3 Pin
kiran dangar6-Jun-11 19:30
Memberkiran dangar6-Jun-11 19:30 
GeneralMy vote of 3 Pin
CTaylor8919-Apr-11 6:04
MemberCTaylor8919-Apr-11 6:04 
GeneralRe: My vote of 3 Pin
kiran dangar6-Jun-11 19:34
Memberkiran dangar6-Jun-11 19:34 
GeneralGood one for Beginners :) Pin
Viji8615-Apr-11 5:36
MemberViji8615-Apr-11 5:36 
GeneralRe: Good one for Beginners :) Pin
kiran dangar6-Jun-11 19:22
Memberkiran dangar6-Jun-11 19:22 
GeneralMy vote of 5 Pin
chandan_tandon13-Apr-11 23:05
Memberchandan_tandon13-Apr-11 23:05 
GeneralRe: My vote of 5 Pin
kiran dangar6-Jun-11 19:20
Memberkiran dangar6-Jun-11 19:20 
GeneralMy vote of 4 Pin
Prakash Mekala15-Mar-11 4:26
MemberPrakash Mekala15-Mar-11 4:26 
GeneralRe: My vote of 4 Pin
kiran dangar25-Mar-11 4:24
Memberkiran dangar25-Mar-11 4:24 
GeneralMy vote of 3 Pin
Harish Sriperambudur4-Dec-10 15:14
MemberHarish Sriperambudur4-Dec-10 15:14 
GeneralRe: My vote of 3 Pin
kiran dangar5-Dec-10 21:18
Memberkiran dangar5-Dec-10 21:18 
GeneralMy vote of 5 Pin
ketkale26-Oct-10 18:47
Memberketkale26-Oct-10 18:47 
GeneralRe: My vote of 5 Pin
kiran dangar25-Mar-11 4:23
Memberkiran dangar25-Mar-11 4:23 
GeneralMy vote of 5 Pin
Bharti Kohad22-Sep-10 21:37
MemberBharti Kohad22-Sep-10 21:37 
GeneralRe: My vote of 5 Pin
kiran dangar23-Sep-10 20:21
Memberkiran dangar23-Sep-10 20:21 
GeneralMy vote of 1 Pin
ShashankRastogi21-Sep-10 9:29
MemberShashankRastogi21-Sep-10 9:29 
GeneralRe: My vote of 1 Pin
kiran dangar4-Oct-11 2:50
Memberkiran dangar4-Oct-11 2:50 
GeneralMy vote of 1 Pin
levteck16-Jun-10 7:09
Memberlevteck16-Jun-10 7:09 
GeneralRe: My vote of 1 Pin
kiran dangar23-Sep-10 20:18
Memberkiran dangar23-Sep-10 20:18 
GeneralNice Work - One can easily understand. Pin
Chetan Patel14-Jun-10 3:08
MemberChetan Patel14-Jun-10 3:08 
GeneralRe: Nice Work - One can easily understand. Pin
kiran dangar23-Sep-10 20:16
Memberkiran dangar23-Sep-10 20:16 
GeneralRe: Nice Work - One can easily understand. Pin
PuckShooter21-Sep-11 8:00
MemberPuckShooter21-Sep-11 8:00 
GeneralRe: Nice Work - One can easily understand. Pin
kiran dangar4-Oct-11 2:52
Memberkiran dangar4-Oct-11 2:52 
Generalnice overview Pin
Donsw11-Jun-10 9:40
MemberDonsw11-Jun-10 9:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.