Asp .Net MVC - SPLessons

ASP.Net MVC Controller

Home > Lesson > Chapter 5
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

ASP.Net MVC Controller

ASP.Net MVC Controller

shape Description

Controller does the following role in MVC.

Adding Controller in ASP.Net MVC

shape Step 1

Follow the below steps to add the controller.
  • Open the Visual Studio 2013 ultimate.
  • Go to File->New->Project as shown in the below figure.
Then, the New Project window will appear as shown in the below figure.

shape Step 2

Select the Visual C#. Click on the WEB. Then, ASP.Net Web Application appears as shown in the following figure.

shape Step 3

Give the Name and click on the OK button as shown in the below figure. Then the following window will appear.

shape Step 4

Click on MVC. Then, automatically the checkbox will be checked. Now, see the Change Authentication button as shown in the below figure.

shape Step 5

Click on Change Authentication button. Then the following window will appear.

shape Step 6

If wanted to set authentication, then change the authentication according to your requirement. All these authentication modes will be discussed later. Click on OK. Again click on OK. Then, the MVC application will be created as shown in the below figure.

shape Step 7

See the Solution Explorer. Solution Explorer contains a folder called Controllers. Right click on Controllers folder and then Add->Controller as shown in the following figure.

shape Step 8

Click on Controller. Then, the following window will appear.

shape Step 9

Select the controller and MVC 5 Controller -Empty. Click on Add button as shown in the below figure. There are some other options too which will be discussed in later chapters. The following window will appear, after clicking on the Add button.

shape Step 10

Remove the Default part in the controller name. Give the Name as you want and click on OK. Then the controller code will be generated as shown in the below figure.