How to add a new page in ASP.NET mvc4?
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
Related videos on Youtube
Comments
-
Dashang over 1 year
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?
-
binarydreams over 11 yearsSince you're clearly new to MVC, I strongly recommend you read through the official ASP.NET MVC guide as it will answer most of the "newbie" questions you might have.
-
-
James over 5 yearsThanks, that's the most concise explanation I've heard!