In this short tutorial, we will demonstrate the basic knowledge of ASP.NET MVC that you need to begin to run a web based application. Also you will learn how to download and make a web application using Visual Studio. We have divided the method in 8 simple steps with graphical aid so that anyone can understand and follow.
What is ASP.NET MVC?
MVC is also a design pattern used to de-couple user interface (View), data (Model), and application logic (Controller). This tutorial is specially designed for beginners and professionals who want to learn about ASP.NET MVC. ASP.NET MVC is also a web framework that is based on Mode-View-Controller (MVC) architecture
In order to understand the depth concepts of ASP.NET MVC, you must have Basic knowledge of NET framework 4.5 and Visual Studio.
ASP.NET MVC Architecture
Here you will learn about ASP.NET MVC architecture.
The MVC architecture is one the earliest framework in software engineering. It is used in all most all language with slight variations but idea remains the same
Now let’s understand what the role of MVC in ASP.NET is.
Parts of ASP.NET MVC application
MVC has divided an application into three parts
It shows what the shape of Data is. A class in C# is used to express the Model. Model objects also store data which is recovered from the database
Model express Data
The role of view in MVC is called the user interface. The view allows the user to display Model data and also enables the user to modify them. View in the ASP.NET MVC, also called HTML, CSS, and some special syntax (Razor Syntax) that allow users to communicate with Model and Controller easily.
View express User interface
The controller manages the User Requests. Often by using view user raises an HTTP request, which is operated by the controller. Controller processes the request, and as a response, it returns a proper view
The controller controls the User request
The following figure shows the relationship between Model, View, and Controller
The figure below shows that when any user enters the URL in the browser. Then it directly goes to the webserver and then goes to the controller. As a response, the controller gives a detailed view and Model to that request, which is granted by the user and sent it back to the browser. This is how Model, View, and controller works with each other.
Things to remember
- MVC means Model, View, and Controller
- Model express data
- View express User interface
- The controller controls the User request
How to create ASP.NET MVC Application
In this part, we will make an MVC web application by using Visual Studio and going to understand the basic Building blocks of ASP.NET MVC Application.
We will use ASP.NET MVC v5.2 and Visual Studio community edition and .NET framework 4.6 to make our MVC Application
Downloading Visual Studio
You can download latest version of Visual Studio from this website.
We recommend you to download visual studio from Microsoft original website.This method is not limited to any version. But you can also use any alternative download sources, such as file hippo or other, based on your convenience.
Steps to create a web Application
Following these steps, you can easily create a web application MVC.
After download Visual Studio Open it and go to file menu -> New -> Project as Shown in the figure below
After opening a new project, expand the Visual C# node and select Web after this select ASP.NET MVC Application (.NET framework) from here, you can give your application a name. You can also change the location By clicking on browse, then click OK
After it selects MVC if it is not already selected
Here you can also change Authentication by clicking Change Authentication
We are not changing the Authentication then click OK
Wait a while till the Visual Studio creates a simple MVC project using its templates
Now press F5 to run your project in debug mode and press ctrl+F5 to run your project without debugging it. This will open a web page in the browser
We have demonstrated the basic concepts of ASP.Net, a brief history of ASP.Net, and its architecture. Following these simple steps, anyone can easily download Microsoft Visual Studio and create your first web application.