SIGN UP MEMBER LOGIN:    
ARTICLE

ASP.NET MVC Basics: Part 3

Posted by Krishna Garad Articles | ASP.NET MVC with C# January 12, 2012
In this article we will see how the ASP.Net MVC application executes.
Reader Level:

Introduction

In this article we will see how the ASP.Net MVC application executes. In the previous article1 and article2 we saw what MVC is. How is it different from ASP.Net? What is ASP.Net MVC? In this article we will see how the ASP.Net MVC application execution is going on.

From the last two articles you have some basic idea about what MVC is, and differences between MVC and ASP.Net. This article will demonstrate the steps involved in the ASP.Net MVC application execution process. In part 2 we saw that the request is first arriving at the controller, then the model will be prepared and finally the view is given as a response to the user but the actual flow is something different. So take a look at the following diagram to see the basic steps involved in ASP.Net MVC application execution.

mvc4.bmp

From the given diagram it is clear to you how the ASP.Net MVC application execution occurs. In the above diagram you see that first when the request comes from the user it's going to the global.asax file as all we know. When our application begins execution it first invokes the Application_Start event in the Global.asax file. In this Application_Start Event, only the routing table will perform the activity of mapping the user requested url with the application. After performing the routing, finally the request goes to the controller. We will explore more about the ASP.Net MVC routing in the next article. So I'm leaving it here to describe the ASP.Net MVC routing.

When the request arrives at the controller, it's defined by routing only; e.g. in our application there are many controllers so routing will map exact controller and the exact method of controller to be executed. Details about the controller you can find in my first article. This controller only will prepare the model and return the view to the user as a response.

Model is nothing but preparation of data e.g. populating data from database or some business logic or some data access. About model my first article will describe very well. Controller can return view without model or with model also. Controller is the thing in ASP.Net MVC which can perform so many actions like which model to prepare? What exactly user wants? And which view should be return to user? All is defined in controller only.

Finally the view i.e. user interface or designed screen for the user as a response is sent back to the user. About the view you can read more in my first article.

Conclusion:

In this way the ASP.Net MVC application execution occurs. In my next article we will see what ASP.Net MVC routing is. So keep reading.

Login to add your contents and source code to this article
share this article :
post comment
 

Thank's daisy

Posted by Krishna Garad Jan 13, 2012

Great what an article. I will surely try to implement this.

Posted by Daisy Krause Jan 13, 2012
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
Become a Sponsor