C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
ASP.NET MVC ProjectIn this topic, we are using visual studio 2017 IDE to create MVC web application. It includes the various steps that are given below. These following steps explain how to create MVC based web application.
Click on file menu from the menu bar and select new submenu to create a new project. The following image show that how to create a new project. Here, select type of project as a web project and provide name of the project. After selecting project type, now select the web template that we want to implement. Since we are working on MVC then select MVC template from the list of available template. At the same time, provide the authentication type to the application. After clicking ok, it creates a project that has following structure: Following is the project structure that we just created. See, the project carefully, it contains three folders named Model, View and Controller. The HomeController is default controller for the application. This controller contains the following code: // HomeController.csusing System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplicationDemo.Controllers { public class HomeController : Controller { public ActionResult Index() { return View(); } public ActionResult About() { ViewBag.Message = "Your application description page."; return View(); } public ActionResult Contact() { ViewBag.Message = "Your contact page."; return View(); } } } Index file is default for the home controller in the view folder. // index.cshtml@{ ViewBag.Title = "Home Page"; } <div class="jumbotron"> <h1>ASP.NET</h1> <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p> <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more</a></p> </div> <div class="row"> <div class="col-md-4"> <h2>Getting started</h2> <p> ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and gives you full control over markup for enjoyable, agile development. </p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865"> Learn more</a></p> </div> <div class="col-md-4"> <h2>Get more libraries</h2> <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866"> Learn more</a></p> </div> <div class="col-md-4"> <h2>Web Hosting</h2> <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p> <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867"> Learn more</a></p> </div> </div> Output: This project produces the following output, when view in the browser.
Next TopicASP.NET MVC Controller
|