Getting Started With ASP.NET MVC

Hello everyone!! In this article we are going to get started with ASP.NET MVC which is a web application framework developed by Microsoft, which implements the model–view–controller (MVC) pattern.

To help beginners to get started…

Follow these steps:

Step 1:

Open your latest version of Visual Studio. Select File, New, then Project to see the following screen. Under the section of Visual C# click on ASP.NE T MVC 4 Web Application. Name it as MyFirstMVCApp.

MyFirstMVCApp

Step 2:

Click on OK Button and select the empty template with view engine as razor .Press the OK Button and project is ready with three folder known as Model, View, and Controller.

empty
explorer

Step 3:

Right Click on controllers folders on the project solution and go to AddController. Name the controller as HomeController and press OK. The controller appears as follows with one default method known as Index() with return type as ActionResult.

code

Step 4:

Right click on Index() method and select Add View. The popup box appears name the view as Index and press Add,

add

A view named as Index will appear on the screen as well as in the solution explorer whichis as follows:
Delete text “Index” and type “Hello World”

Hello

Step 5:

Now go to App_Start folder on the solution explorer and move to RouteConfig.cs file. Change the name of the controller to ”Home” if anything else by default and action to “Index”

code

Step 6:

Build and rebuild the solution and run the Index.cshtml file by pressing the F5 key to see the output
That’s it we are done!!!!!

output
This is a very basic introduction to MVC pattern, how it is implemented and how it  works . I hope you understood and enjoyed this article.

Read more articles on ASP.NET:


Similar Articles