Introduction to MVC4

‘Hello World’ Web Application in MVC

This is basic approach for making you understand the structure and how MVC works.


1) Open Visual Studio 2012

2) Select File–>New–>Project

3) A popup will be open, where you can see the list of all available templates for Windows and Web application. Select the Web application from the left hand side and also select the Template from the right hand side of the popup i.e. “ASP.NET MVC 4 Web Application”. Here you also provide the Proper application name and also select the folder where you save the application.

4) Select the “Ok” button, then after again a Popup will be open where you have to select the proper template for the application. Here in this case “Empty” Template is selected from the “Project Template”.

5) Now Right click on the “Controller” folder and then select Add——->Controller. A popup will be open where you give the appropriate name with suffix as a controller and click the add button. HelloWorldController class is opened.

6) Right click on the “Index” function in the “HelloWorldController” and select the “Add View…” option and click the “Add” button.

7) “Index.cshtml” file is created inside the “HelloWorld” folder which is inside the “Views” folder.

8) Now Open the “Global.asax.cs” file and change the following code snipet .

                                                name: "Default",
                                                url: "{controller}/{action}/{id}",
                                                defaults: new { controller = "HelloWorld", action = "Index", id = UrlParameter.Optional }

9) Run the application by pressing the F5 key.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s