Chapter 3. The controller in depth
This chapter covers
- Understanding controller anatomy
- Leveraging viewless controllers
- Testing controllers
- Using form and querystring values
- Binding action parameter
- Developing action filters
The focus of the Model-View-Controller pattern is the controller. With this pattern, every request is handled by a controller and rendered by a view. Without the controller, presentation and business logic would move to the view, as we have seen with Web Forms. With the ASP.NET MVC Framework, every request routes to a controller, which is simply a class that implements the IController interface. Microsoft provides the base class System.Web.Mvc.Controller to make creating a controller easy. The controller base class you choose is not crucial because most request processing goes into executing the ActionResult, which is the type that each action returns.