Skip to Content
Beginning ASP.NET MVC 1.0
book

Beginning ASP.NET MVC 1.0

by Simone Chiaretta, Keyvan Nayyeri
August 2009
Beginner to intermediate content levelBeginner to intermediate
575 pages
13h 16m
English
Wrox
Content preview from Beginning ASP.NET MVC 1.0

Chapter 5. The Controller

The controller is the last letter of MVC, but if the naming followed the real correlation between the components of the pattern, it would have been placed in the middle. The controller is the orchestrator of the operations and is the component that stands between the model and view and passes data between the two.

The previous chapter covered the model part of the pattern. In this chapter, you learn in detail about the controller.

Specifically, you learn:

  • The responsibilities of the controller

  • How to create the controller

  • How to read inputs and pass data to the view

  • How to access the core ASP.NET objects, like Response, Cache, and similar objects

What the Controller Does

You already had a quick overview of how the controller fits into the MVC pattern in Chapter 1. In this section, you learn in detail what its responsibilities are.

The controller is the main component of an MVC application, and its role is even more important here in the ASP.NET MVC framework, which adopts the Passive View pattern. One common misconception is that the main role of the controller is to keep the model and the view separated, but its main role is to mediate between the end user and the application: The fact that it also connects the model with the view is just a side effect. In fact, not including the routing mechanism, the controller is the first component of the application that receives the input from the users.

The tasks that the controller has to perform are capturing and validating ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET MVC 4

Beginning ASP.NET MVC 4

José Rolando Guay Paz
Programming ASP.NET MVC 4

Programming ASP.NET MVC 4

Jess Chadwick, Todd Snyder, Hrusikesh Panda
Professional ASP.NET MVC 2

Professional ASP.NET MVC 2

Jon Galloway, Phil Haack, Scott Hanselman, Scott Guthrie, Rob Conery

Publisher Resources

ISBN: 9780470433997Purchase book