Model View Controller
These days, Model View Controller (MVC) is a buzzword in the ASP.NET community, thanks to the upcoming ASP.NET MVC framework that Microsoft is expected to launch soon (at the time of writing of this book, only Preview 5 was available). This chapter is dedicated to MVC design and the ASP.NET MVC framework.
In this chapter, we will learn about MVC design patterns, and how Microsoft has made our lives easier by creating the ASP.NET MVC framework for easier adoption of MVC patterns in our web applications. The following are some highlights of this chapter:
* Understanding the Page Controller pattern
* Understanding the need for the MVC design pattern
* Learning the basics of MVC design
* Understanding the Front Controller design pattern
* Understanding REST architecture
* Understanding the ASP.NET MVC framework
* Implementing the ASP.NET MVC framework in a sample application
Page Controller Pattern in ASP.NET
controller pattern, which is the default architecture in the ASP.NET web forms. Let us understand page controller in detail.
In Chapter 2, we noticed that inline coding samples in ASP and ASP.NET had HTML and code scripts mixed together, creating a hard-to-maintain code base. Then we studied how code-behind classes "modularized" the architecture by separating the logic from the HTML. This code-behind architecture is a page controller based design, where by controller we mean the components that control the rendering of the HTML, which in the case of ASP.NET web forms are the code-behind classes.
Each page has a code-behind class, and the URL requested by the client is directly handled by individual pages. Any button or server control causing postbacks (such as a DropDownList control) is handled directly by the page code-behind class. So understanding the page life cycle is very important in a page controller based architecture.