Advantages of the ASP.NET MVC Approach - The First Advantage
(Page 3 of 4 )
(1) No Resting upon ViewState and Postback
The ASP.NET MVC framework does not use the ASP.NET Postback model for interactions with the server. Instead, all end-user interactions are routed to a controller class. This maintains separation between UI logic and business logic and facilitates testability. As a result, the ASP.NET view state and ASP.NET page life-cycle events are not integrated with MVC-based views.
Also, the MVC framework doesn't consider any URL as the endpoint to a physical server file to parse and compile to a class. In ASP.NET Web Forms, you have a 1:1 correspondence between a URL and a resource. The only exception to this rule is when you use completely custom HTTP handlers bound to a particular path.
In the MVC framework, a URL is seen as the means to address a logical server resource, but not necessarily an ASPX file to parse. So the URLs employed by the pages of an MVC framework-based application have a custom format that the application itself mandates. In the end, the MVC framework employs a centralized HTTP handler that recognizes an application-specific syntax for links. In addition, each addressable resource exposes a well-known set of operations and a uniform interface for executing operations.
So, in the MVC world, you do not bother with the ViewState and Postback any more. And also, the client side HTML contents will become clean without “client side ID pollution” troubling you. For this, we are not going to provide related code illustration, so you can dissect and test yourself according to the "MVCeProduct" sample project provided in the fourth part of this tutorial.
Next: The Second Advantage >>
More ASP.NET Articles
More By Xianzhong Zhu