Asp.net MVC Tutorials About Controllers


Asp.net MVC Tutorials About Controllers


Asp.net MVC Tutorials About Controllers. Controllers are the center point of all the data flow in the application. It takes the input HTTP request and rendering the exact output. So controllers are controlling all the flow. Whenever a new request comes from the browser then the controller takes the request and processes
which Model will be taken, and then it takes the data from the model to the respective view.

Points To Remember

  • Controllers are the Classes derived from System.Web.MVC.Controller.
  • Controllers contain public methods. These methods are called Action Methods.
  • The class name must end with Controller like  TestController
  • All Controller Classes are available in the Controller Folder Structure.

Steps To Create Controller 


Step 1:
               Open the Visual Studio and click on File Tab --> New -->Project menu

         
Asp.net MVC Controllers

 Step 2:
               Select Web from left pan next select asp.net web application and give the proper Name,     Location, and Solution at below pan finally click OK button. then you get one more Popup box where you choose the MVC option. Click the OK button. asp.net creates a template for a project.
                 
Asp.net MVC Controllers Tutorials

Step 3:

           You can find the Controller folder has some Controller Classes with .cs extensions on the right side. every controller ends with Controller. You can observe from the Controller folder has three classes. These classes are AccountController.cs, HomeController, and ManageCotroller 

Asp.net MVC Controllers Tutorials

If you open any one controller then you find the controller inherited from Controller. and each controller has Action Methods. From the below image, you can observe. 

Asp.net MVC Controllers Tutorials




Previous Post Next Post