0

Simple as it is : Why to move to Asp.NET MVC & why not to move ( if there is any reason ) ?

Added

Is it a necessity to move ? Can we say the future belongs to asp.net mvc ? How many years do you think it can stays on top ?

Kasrak
  • 1,509
  • 4
  • 24
  • 48
  • 5
    Duplicate of http://stackoverflow.com/questions/102558/biggest-advantage-to-using-aspnet-mvc-vs-web-forms , http://stackoverflow.com/questions/328465/how-to-decide-which-is-right-webforms-or-mvc-when-doing-asp-net , http://stackoverflow.com/questions/832305/when-not-to-use-asp-net-mvc , and many others. – Matthew Flaschen Jul 10 '09 at 09:13
  • If it's duplicate, use the flag link under the question. – radu florescu Nov 19 '12 at 10:39

4 Answers4

3

MVC is much more well constructed, allowes for much better code seperation and control over markup, and is much lighter on the server, that IMHO the only reason not to move is if you have a legacy .NET application (or other) that is working flawlessly, and you're not expected to perform serious adjustments / fixes on it in the near future.

If you do decide to move, you should know that you'll be able to reuse very little of your webforms GUI and user controls, since MVS is built a bit differently. You class libraries you could reuse, if they're written well. In any case, writing stuff in MVC is much faster than in WebForms, even if done from scratch.

synhershko
  • 4,472
  • 1
  • 30
  • 37
  • Can we use the controls that we have made for Forms platform on MVC , or How hard is to move them to MVC ? – Kasrak Jul 12 '09 at 07:23
  • 1
    Not directly within MVC, as ASCX in MVC are used for Partials. MVC and WebForms are completetly different and incompatible frameworks, hence WebForms user-controls will not work with MVC as-is (for example, UCs rely on ViewState and page life-cycle and MVC doesn't have it at all). Porting WebForms ASCX to MVC compatible Views/Partials really depands on your code, level of concerns separation, and flow. You might want to check a 3rd option - combining MVC and WF in your project - see http://www.springerlink.com/content/p135205160712rm6/. – synhershko Jul 12 '09 at 15:19
  • Also, you might want to check the SO questions Matthew Flaschen linked to in a comment to your question. – synhershko Jul 12 '09 at 15:23
1

also looking at moving at the moment.

the main bonus for me is the complete control over layout. i'm also looking into implementing a restful API which the MVC model works very nicely with because of the path structure.

Josh

Josh
  • 6,256
  • 2
  • 37
  • 56
1

If we move for MVC we can add or edit any module so easyly. So we can add any new module just like a plugin

Nagu
  • 4,954
  • 14
  • 52
  • 67
0

I patrially disagree with the accepted answer. I have built large applications in both WebForms and MVC and here is my opinion:

ASP.Net Web Forms and ASP.Net MVC are both great frameworks that allow the C#/VB Net developer to build enterprise level applications. Choosing which one to use for your app depends on a few factors. The MVC model has been around for many years, it is well suited if you need more fine-tuned control over the page cycle process and it is also superior when it comes to unit testing etc, because it supports true separation of business logic and presentation layers.

However, do not dismiss Web Forms, the reality is you can continue to use the web forms framework and still have tight control over your page elements be simply moving away from pre-built server controls and integrating HTML5 standard controls. You can take advantage of new JavaScript frameworks like jQuery, you can improve search engine friendliness by using techniques like URL Re-Write, and you can reduce or eliminate post-backs by taking advantage of asynchronous frameworks like jQuery AJAX and SignalR.

The main reason I disagree with the accepted answer is the statement "writing stuff in MVC is much faster than in WebForms" is completely inaccurate. As any developer who has actually built MVC apps will tell you, it's actually much fast to build WebForms apps. The reason is not just learning curve, but the fact that while MVC gives you the benefit of "under-the-hood" access to the page cycle and more direct access to HTML output, is also the reason it takes longer to build MVC apps. Trust me, you will find yourself doing much more "plumbing" work than you ever did with "drag-and-drop" WebForms development.

The fact is, there was a lot of hype when ASP.Net MVC first came out and too many developers assumed it was a replacement for Web Forms. It hasn't. As I stated in the beginningm both frameworks are great, they both have their pros and cons. I would guess that 90% of developers are still building new apps in WebForms.

That's my 2c.