How to add a new page in ASP.NET mvc4?

asp.net, asp.net-mvc-4

Solution

In ASP.NET MVC you work with Models, Controllers and Views. Controllers are classes containing methods called Actions. Each Action is used as an entry point for a given user request. This Action will perform any necessary processing with the model and return a view. So basically you will start with defining a Controller (if not already done) and add Actions to it:

public class HomeController: Controller
{
    public ActionResult Index()
    {
        return View();
    }

    public ActionResult SomeAction()
    {
        return View();
    }
}

Then you right click on the Action name and select the Add->View option which will create a new View for the given Action in the respective `~/Views` folder.

I would recommend that you start by going through the basic tutorials here: http://asp.net/mvc

Problem

I want to make a new project and I want to add a new page, using the Microsoft sample website as a starting point. The Microsoft sample website already has an About and a Contact page. How do I add a new page to the sample website using ASP.NET mvc4?

Original source