Quantcast
Channel: .notes » asp.net
Viewing all articles
Browse latest Browse all 8

From Asp.net Webforms to Asp.net MVC

$
0
0

I’ve been using MVC recently for a while now, both at work and on my own, I am really enjoying it, the implementation proposed by Microsoft is simple and effective and it sticks more to the nature of a web session(request/response) than the Webform model with all it’s page lifecycle, control events and so on.  The move to MVC should happen when you are not using anymore the core feature of Asp.net Webforms: its controls. If you find yourself creating an html list inside the aspx page using a foreach instead of using a repeater, if you prefer using jQuery instead of an Update Panel, then you should move to MVC.

This is not a comparison between the two tecnologies, there’s plenty of resources out there, here are the key points making me prefer MVC over Webforms.

  • Absence of  in-between page states (Page load, render etc),  with MVC you call an action and you get a response back, that’s it.
  • Cleaner pages without generated code (es ViewState).
  • More control over the content and what is rendered using a View engine and html instead of webcontrols.
  • Possibility to unit test each request a client will make.
  • A lot of community resources.

Webforms has been the perfect fit in the pre Ajax era, when tools like jQuery didn’t exist, the common focus was on trying to do everything “server side”. MVC reverse this statement: the look and behaviour of the page is handled by the View while the server is only responsible of receiving and responding to the client requests. Assuming that with both MVC and Webforms you can achieve exactly the same goals, the choice is really up to how many feauters of each model you will use.



Viewing all articles
Browse latest Browse all 8

Latest Images

Trending Articles





Latest Images