This post gives you the basic overview on ASP.NET Models, Views and Controllers. It explains how all parts in MVC Application work together and discuss how the Architecture of an ASP.NET MVC application differs from an ASP.NET Web Forms application.
The Sample ASP.NET MVC Application
- Launch Visual Studio 2008, Select the menu option File, New Project then New Project Dialogue box appear as shown below

Select the ASP.NET MVC Web Application Template from the dialogue box and click Ok.
- When you create a ASP.NET MVC Application, Create Unit Test Dialogue box appears as shown below.

Select the No, do not create a unit test project and click Ok.
- After ASP.NET MVC Application is created. You will see several folders in Solution Explorer. You will find three folders named Models, Views and Controllers.

If you expand the Controllers Folder, you will see a file named HomeController.cs and if you expand the Views folder you will see About.aspx and Index.aspx under Home Sub Folder.
- Now you run the application you will see the following output

If you return to Visual Studio project you do not find the Home or About page.
A URL Does not Equal to a page in the application
- When you build a ASP.NET Web Application, there is a correspondence between a URL and Page. If you request a page test.aspx from the server then page must be on the disk other wise 404 - page not found error will come.
- When you build a ASP.NET MVC Application, there is no correspondence between URL and page that you found on the disk. Here a URL corresponds to a controller action instead of a page on the disk.
- In ASP.NET Web Application, Requests are mapped to pages. In ASP.NET MVC Application ,request are mapped to controller actions.
- ASP.NET Web Application is content-centric and MVC Application is logic centric.
- Here Browser Request is mapped to controller action through a feature called URL Routing. URL Routing route the incoming requests to controller actions.
- URL Routing uses Route Table that will be created when application first starts.
- Route table is setup in the Global.asax file.
The Default Global.asax file looks like
When ASP.NET Application first starts, the Application_Start() method is called. This method calls the RegisterRoutes() method which creates the default route table. - Route table breaks the incoming request into 3 parts
- First part is mapped to a controller name, the second part is mapped to an action name and final part is a parameter that passed to the action.
Example: /Student/Details/3
This URL is parsed into three parts like this:
Controller = StudentController
Action = Details
Id = 3
If you run the sample ASP.NET MVC Application with out supplying a URL, the URL is parsed like this
Controller = HomeController
Action = Index
Id = ""
A Controller is responsible for sending the response back to a user who makes the request. Controller is just a C# class file. The Sample MVC Application contains the controller named HomeController.cs located in the Controllers folder.
The Controller in the ASP.NET MVC Application looks like

Note: The two methods in the controller Index() and About() corresponds to two actions Home and About clicks.
Views
- A view in the ASP.NET MVC Application contains the HTML elements and content that is sent to the browser.
- The two actions in the controller return a view.
- A View is equivalent to a page in ASP.NET MVC Application.
\Views\Home\Index.aspx
If you want to return a view for a controller action, you need to create a sub folder in the Views folder same name as controller and create a .aspx file with same name as the action.
Models
A Model in ASP.NET MVC Application contains logic that is not in the view or a controller. The Model should contain your business logic and Data access logic.
Conclusion
We had a overview on ASP.NET MVC application and URL Routing. We learnt the functionality of Model, Controller and View in the ASP.NET MVC Application.

vivek naikPosted Dec 5, 2012, 8:27 AM
oppo pp l;ll ;l;l; ;ll;l;l; l;l;
sumaira manzoor hussain khanPosted Nov 16, 2011, 3:07 AM
hello sir; this is your good artical. do you have uml experties. becoz i need a help about uml diagrams regards sumaira manzoor
Former memberPosted Oct 11, 2011, 5:18 AM
good article. kalyan
thant zinPosted Jan 26, 2011, 11:10 PM
I have one problem. When i run MVC Default Page, there is server error message appear. like this" Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.] System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0 System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +42 System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +145 System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +73 System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +111 System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +279 " How can i solve it?
meera shahPosted Feb 13, 2010, 4:33 PM
i have a website with BAL, BO , DAL , layers in addition to ASPX pages .... How do i identify which layer can be incorporated into the folders Model, View and Contrioller folders ??????????
gautam mokalPosted Dec 9, 2009, 12:27 AM
very well written. helpful for beginners. I have two doubts. 1)can all traditional applications be developed using mvc asp.net technology.? 2) or should we select between 2 technologies before developing the applications?
rammohan sudhamPosted Nov 18, 2008, 2:57 AM
please keep more articles on this topic, and give me ur mail id if i have any doubys i will contact u my mail id: [email protected] please send one test mail
MarcPosted Oct 23, 2008, 4:03 AM
Hi, I don't see this template from my vs 2008 pro. Does this project template only exists on VSTS versions or belongs to an extension? Thanks, Marc
Ruben OrtizeditedPosted Oct 7, 2008, 3:33 AMEdited Oct 7, 2008, 3:34 AM
This frameworks are build on java applications some years ago. An example is Apache Struts, that was built since 2000. Microsoft should watch java platform and copy their ideas before.
NageshwarRao ciliveruPosted Oct 7, 2008, 1:04 AM
Hi Kalyan, Its good. Expecting more articles for MVC from your end.
Mahesh ChandPosted Oct 3, 2008, 8:09 AM
Good article Kalyan. Wonder what is the advantage of using MVC over traditional n-layer projects?