Model View Controller termed as MVC is a software design
pattern for developing web applications. MVC constitutes below mentioned important three
1. Model in MVC is basically class (C# or Vb.Net)
which will maintain the data.
2. A Model will be accessible by both Controller
3.Model will be used to pass data from controller
4.View will use the Model to display the data in
1.View is .csHtml (or) .aspx file without having
code behind file.
2.View can be made as dynamic by using server
tags. Inside the server tags, user can write the code to make it dynamic.
3. Request will be made to View from controller's
1. Like Model, Controller is a class (C# or Vb.Net)
which inherits System.Mvc.Controller.
2. Controller will use Model for data manipulation
and pass it to View.
3. Controller use Viewbag, ViewData to pass any
type of data to View.
Flow of MVC:
Client request by entering the URL in the browser. for e.g. example.com/home/index
MVC Routing will parse the above mentioned URL through
"application_start()" method which is present in Global.asax as
From the above URL, MVC routing will determine the below
Controller - Home
Action - Index
Id - Empty (Since
the URL doesn't have the Id, it will be considered as empty)
We can write our own routing in the existing routing method.
Routing will get executed based on the priority. (i.e. routing defines at first
will have top most priority)
Now MVC will call the "Home" controller class
first (i.e. HomeController.cs) in order to trigger the specific action method.
Here the action method is "Index", so it will call the Index method
present in the HomeController class.
After coming to the "Index" action and completing
business logic and populating data in the object model, MVC will call the
specific view to load the UI page by passing data.
for e.g. inside an action method, calling return view() (or)
view ("Home", Model) (or) view ("Index", Model) will return the specific view
present in the /views/home/index.cshtml (or) Home.cshtml.
These are the process and working methodology of MVC.
Thanks for reading, leave your comments to
improve this article. In next article, we will see some basic concepts in MVC.