Controllers and Action Methods in ASP.NET MVC Applications

Controllers and Action Methods in ASP.NET MVC 



The Controllers Folder ASP.NET MVC:

The Controllers Folder contains the controller classes responsible for handling user input and responses.

MVC requires the name of all controllers to end with "Controller".
In our example,

Visual Web Developer has created the following files:


HomeController.cs (for the Home and about pages) and AccountController.cs
MVC was one of the seminal insights in the early development of graphical user interfaces, and one of the first approaches to describe and implement software constructs in terms of their responsibilities.

The ASP.NET MVC framework maps URLs to classes that are referred to as controllers. 

Controllers process incoming requests, handle user input and interactions, and execute appropriate application logic. A controller class typically calls a separate view component to generate the HTML markup for the request.

The base class for all controllers is the ControllerBase class, which provides general MVC handling. The Controller class inherits from ControllerBase and is the default implement of a controller. The Controller class is responsible for the following processing stages:
Locating the appropriate action method to call and validating that it can be called.
Getting the values to use as the action method's arguments.

Handling all errors that might occur during the execution of the action method.
Providing the default WebFormViewEngine class for rendering ASP.NET page types (views).

MVC Controller by Wikipedia:

Trygve Reenskaug introduced MVC into Smalltalk-76 while visiting Xerox Parc in the 1970s. In the 1980s, Jim Althoff and others implemented a version of MVC for the Smalltalk-80 class library. It was only later, in a 1988 article in The Journal of Object Technology, that MVC was expressed as a general concept.

The MVC pattern has subsequently evolved; giving rise to variants such as HMVC, MVA, MVP, MVVM, and others that adapted Model View Controller to different contexts.



 Asp.net Related Other Post:

Comments