If you have done asp.net webforms in visual studio, then this tutorial is very easy for you. Hello World MVC application
MVC stands for Model View Controller.it is a framework for building web applications using a MVC design:
Model : The Model represents the application core (for instance a list of database records).
View : The View displays the data (the database records).
Controller :The Controller handles the input (to the database records).
Creating a Asp.Net MVC application in Visual Studio:
Open visual studio --> New Project --> Select Asp.Net MVC 3/4 Web Application. --> give name as HelloWorldMVCApplication --> click OK
Now you have created MVC application. Once you have done this, you can see many folders at right side(in solution).
Then you have to add controller to this project. for this
Right click on Controllers --> Add --> Controller --> name it HelloWorldCOntroller --> click ADD
after adding the controller open it, you can see a method like this
public ActionResult Index()
it is a default method in controller which returns view to the browser.
Now, you have to add View to this controller. for this
Right click on Index() method --> add --> click Add.
Once check your Views folder now. The view which you have just created will be added to this folder.
Open your newly created View file(index.cshtml) and write this
Save your file, and run it. In your browser you will get resource cannot be found error.
This is because we did not set any default page for our application. Once check your browser URL. you will see something like this.
http://localhost:3371/ (3371 is my port number. it might be different for you)
now change it to
http://localhost:3371/http://localhost:3371/HelloWorld (here HelloWorld is the name of our Controller)
Now press enter , then you can see the output of the page we have just created.
This is a basic MVC application for beginners just to give yo the guidance on how to create a MVC application and how to run a MVC webapplication.
Thank you !!
Hello World MVC application