Create Simple Asp.Net MVC Application (Sample) or Project

  Total Views : 12457
  Comments : 0
  Keywords : Create simple application in mvc 4, Sample Application in mvc, Create simple mvc 4 application, Create sample app in mvc

Here we will learn how to create simple hello world application in mvc with example.

Create New Asp.Net MVC Application

To create new application in mvc first open visual studio from Start page select File à New à Project like as shown following image


create new mvc project from visual studio 2012


After that a new dialog pop up will open from that select Templates à Visual C# à Web à In project select ASP.NET MVC 4 Web Application and enter Name of Project “Tutorial3” after this just click on OK button. 


Now new ASP.NET MVC 4 Project dialog will appear from that select Basic Template and select view engine as Razor and click OK button like as shown below


select basic template to create new application in mvc


Once we click OK button it will create new basic mvc application that would be like as shown below


Sample mvc application project structure


Now we will add new controller for adding Controller for that right click on Controller folder à then select Add from List inside that select Controller. Once we select controller new pop up will open in that give controller name as "Default1Controller" and from Template select Empty MVC controller and click on Add button.


After adding Default1Controller you will find a controller with default method name Index of return type ActionResult which will return view() like as shown below. Generally the View is responsible for displaying data and transforming Model or Models to visual representation. 


using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.Mvc;


namespace Tutorial3.Controllers


public class Default1Controller : Controller



// GET: /Default1/

public ActionResult Index()


return View();





Now let’s add empty View to add view open Default1Controller right click anywhere and select Add View like as shown following image


adding view to controller in mvc application


After Clicking on Add view a new dialog will pop up for view configuration. Here we will keep View name same name as ActionResult name and for creating empty view we will not select Model class here and just click on Add button


Give view name and model in add view template in mvc


After adding you can see an empty View. Here we can add some text in View and just run application to test empty View 


Adding text to view in mvc application example


For accessing this page type URL like http://localhost: port number / Controller name / View name e.g. http://localhost:42088/default1/index. After typing this URL you will see Index view with message we wrote on it. Now we have completed adding view mvc hello world application example result

 Comments (0)

Be the first to give your valuable feedback

Leave a comment

  • Default Tutlane User