Home  /  Questions  /  Question



73   96.1
Feb 23, 2011


Why should we use MVC vs normal ASP.NET?

Why should we use MVC?  Can we do rich GUI controls like we used to in regular ASP.NET applications?
Can we use Session, Javascript, Validators, Ajax controls, and others in MVC?

Are MVC applications faster than normal ASP.Net application?
Can we do everything in MVC just like we can in normal ASP.NET application?
MVC



1,364   100.0
Feb 23, 2011
There are various positive points to moving towards MVC

1.  TDD support out of the box as most of the design is based on interfaces.
2.  SEO friendly URL by design (though now this is possible in ASP.NET 4 as well)
3.  No ViewState (this may seem a bit of moving backward to some), but overall a good design decision.
4.  Clean View Markup (no additional HTML emitted)
5.  100% extensible.  You can add your own controller with IOC, switch view engines at will, control model binding at wish etc.
6.   Rich UI support (possible through client side JS libraries like jQuery UI and others).  Telerik has released some controls for MVC which includes Grid control as well (which are merely HTMLHelpers)
7.  Session, JS, Ajax works.  Validation is even more powerful with DataAnnotations and jquery.
8.  Is MVC faster?  Yes by default because of lack of viewstate and clean markup.  But performance is subject and MVC by design is more performant that traditional ASP.NET webforms (though webforms can be made as fast as required.
9.  Out of the box support for mitigating antiforgery attacks and XSS vulnerability (though asp.net does has this to some extent)
10.  Out of the box minimal IOC support.
11.  Full control over rendered HTML
12.  Pluggable architecture
13.   And much more....

Couple of limitations (though not exactly)
1.  Learning curve as most asp.net developers are used to windows form model for web development.


NOTE:  Webforms is not bad.  But by design it encourages many bad practices.  A webform at the hands of careful developer is as or could be even more productive than MVC.  Just my thought.

Additional readings at http://msdn.microsoft.com/en-us/magazine/dd942833.aspx

Hope this helps.


 2 comments
 
Thankyou so much Rajesh. --- Rahul Tripathi  Feb 25, 2011
 
You are welcome. --- Rajesh Pillai  Mar 02, 2011

0   0
Mar 27, 2017
MVC is lightweight framework with clear separation between code and HTML. It has following major benefits.

  1. With Model (Business logic), View (UI logic) and Controller (Input logic) being separate entity, Test driven development is possible
  2. It does not have viewstates (which is both positive and negative)
  3. Business logic is stored in a single state called model where in traditional asp.net platform, each page has its own business logic making it complex.

There are other benefits as well but these are the most logical statements that shifts the favor to MVC.

50   50
Feb 23, 2013
Who wants to have more control over things they are responsible for , well every one wants to have more and better control over things they are involved in. So whole concept of the story in our programming world is we don't want rigidity, fragility, immobility,and tight coupling What MVC brings to us is a Pattern that divides the chain of responsibilities into Model, View and Controller. But with this adaptive and flexible behavior comes the cost and time values so if the target application is a small scale one then ASP.Net is good to start with. But when the application is big and we aspect changes to be a regular visitors to our development area so we really need to separate the whole application into components and modules and create a chain of responsibilities with those components (Every Component have single responsibility ) and since all those components are self sustaining so we can even test those components without depending of any other components, thus we isolate i.e we divide then test then re-factor and eventually conquer. So the question is street fight or war, what are you getting prepared for.

69   95.9
Feb 21, 2013
ASP.NET and MVC are getting a little closer with each release of Visual Studio (examples include Routing, the Razor engine, and more).
I can see that over the next few years ASP.NET borrows more and more from MVC until the two are like twin sisters...

My 2 cents.

75   96.3
Apr 22, 2011
Your question depends whether you're contemplating a move from WebForms ASP.NET to ASP.NET MVC or making a choice between the two if you're starting with ASP.NET.

If you're starting go with MVC. If you're a seasoned WebForms developer and maintaining current WebForms apps, stay with WebForms. Converting apps is time consuming, error prone and time could be used to add/enhance app functionality.
WebForms is still a very viable platform. It gets better with every .NET/Visual studio version while reducing prior limitations.

If you depend on third party GUI Frameworks like from Telelrik, Infragistics, ComponentArt, DexExpress, their controls are more mature for WebForms than MVC.  These controls offer high productivity, have good looking output and you don't have to worry about browser inconsistencies and bugs. They take of these issues for you. This also means you probably have less control of their html output. Something to think about if you want to spend your development time in the backend and business aspects of the app and less on the front end and GUI stuff.

70   96.1
Apr 11, 2011
One main benefit of ASP.NET MVC is that you can easily and quickly write RESTful implemenations. Also, ASP.NET lends itself more towards pure browser coding of controls and usage of jQuery, true seperation of concerns. Things are more cumbersome with the old ASP.NET server controls.

1,128   99.9
Mar 08, 2011
If I were to use/learn a .Net web framework today, I would most certainly go for ASP.Net MVC mainly due to the benefits pointed out in the excellent post by Rajesh. But, if I were to choose any web framework (not limited to .Net), I would probably use Rails or Django as they seem (to me) to be far easier to work with.


Good Luck!
 1 comment
 
Yeah agreed.. In fact I am evaluating an alternative framework for a specific requirement, and I am inclined towards Rails or Django. Both are great to work with. --- Rajesh Pillai  Mar 08, 2011

60   95.3
Mar 05, 2011
I would continue to use Webforms.

In my opinion, the question is becoming blurred with a lot of the cool features of MVC making their way into Webforms. ASP.NET 4.0 added URL Routing, reduced ViewState, and greater control of the HTML mark-up produced by many ASP.NET controls, now the next version of Webforms will incorporate many more MVC features into Webforms.

What’s coming in the next version of ASP.NET Webforms?