What do you need to start:
- Visual studio 2008 sp1 or visual web developer 2008 sp1.
- ASP.NET MVC Framework
I will use Visual studio 2008 sp1, so let's get started.
- After installing the framework open visual studio and select File>New>Project then from the left tab select web then from the right tab select ASP.NET Web Application
- Now from the debug menu choose start without debugging or Press ctrl+f5 to see how the application looks like.
- Now back to visual studio look at the solution explorer, it should be like this
- Now let's examine these folders:
- We have the Content folder which contains Site.css file that defines the initial styles for the website
- We have the Controllers folder that contains HomeController.cs which
contains the code for the default view and HomeController.cs which contains the
code for managing the login process and new user registeration. - An empty Models folder
- We have Scripts folder that contains several javascript files (JQuery and Ajax
files). - We have the Views folder that contains subfolders containing the index page
(Home page) and the login and registeration pages. - Finally we have a default.aspx and Global.asax file and web.config file.
- For the sake of demonstration we're going to delete the following
- Now Back to HomeController.cs replace the code with the following:
public string Index()
{
return "Hello World";
} - Build and run you should see something like that
- Now you have created your first MVC Hello World application
No comments:
Post a Comment