Full control over HTML - ASP.NET MVC doesn’t support server controls, only option available is using html input controls, so we will be sure about final html rendered at the end. We will also be aware about 'id' of every element. And so integration of ASP.NET MVC application with third party JavaScript libraries like jQuery becomes easy.
Support for parallel development - In ASP.NET MVC layers are loosely coupled with each other, so one developer can work on Controller ,at the same time other on View and third developer on Model. This is called parallel development.
SEO, URL routing and REST - Rich routing features lets treat every URL as a resource supporting RESTful interfaces.
Also user-friendly and readable URL improves SEO.
Extensibility - ASP.NETMVC supports multiple view engines like aspx, razor and if required we can create our own.
Existing ASP.NET Features – ASP.NET MVC framework is built on top of matured ASP.NET framework and thus provides developer to use many good features such as forms authentication, windows authentication, caching, session and profile state management etc.
Disadvantages:
More learning effort - Absence of event driven programming model and ViewState makes ASP.NET MVC a very difficult framework for developers with no or little experience in web application development.
How ASP.NET MVC works
User makes the request for some resource in server (by putting some URL in the browser).
Request comes to controller first (routing engine is the one who is responsible for deciding which request will be handled by which controller. In this article we won’t talk in depth about this behavior).
Controller if required talk to model for data.
Model operates on database (or on some other data sources) and return data (in form of business objects) to controller.
Controller chooses the appropriate view (like say Customer view which will may contain some html tables, drop downs, textboxes…).
Controller passes the data (model data retrieved in step 4) to chosen view(in step 5), where data will be populated as per convenience.
Controller sends back view to the user.
This was for get request, same happens for post. Only instead of putting URL in the browser user will do some action on already requested page and flow start with the controller. Actions like clicking button, changing drop down value etc.
Why ASP.NET Web Forms and Why ASP.NET MVC?
Each can be the “best choice” for a particular solution depending on the requirements of the application and the background of the team members involved. What to choose and when has more to do with business prospective than which one is better than other. When facing a decision to choose between ASP.NET Web Forms or ASP.NET MVC it is important to know that neither technology is meant to replace the other.
Two important factors you should consider while making the choice is
Rapid application development - If you want to develop anything rapidly ASP.NET Web Forms is the only chance you are having, you can’t even consider for ASP.NET MVC for RAD. (Reasons for RAD may be anything like client is not paying too much, or application is going to be used for only one or two months and won’t require much maintenance.)
Unit Testing - If automatic unit testing is most important factor for you MVC will be best for you.
Other than these, what you can do is, write down all your project requirement and try to compare them with Pros and Cons of both Web Forms and MVC and if possible try to ask yourself following questions and point MVC and Web Forms accordingly
Does your team have good experience with Web Forms or Windows Forms?
Well, if yes then probably learning ASP.NET MVC is going to be a tedious task for team, because developers have been used to with ViewState and event driven programming by now and migration is going to be a difficult task.1 point to Web Forms.
Does your team have good experience with ASP.NET MVC?
If yes ASP.NET MVC get 1 point
Does your team have experience on ASP or non-Microsoft technologies such as android, ios, JSP, ROR, PHP?
If you have been JSP or ASP developer prior then you might be familiar with HTTP get and Post and even u might have hands on with MVC because most of them use MVC by default. It gives 1 point to ASP.NET MVC.
Is JavaScript going to be used extensively?
If Yes, MVC gets the point because you get complete control over HTML. 1 point ASP.NET MVC.
Looking for good performance?
With no support for ViewState ASP.NET MVC provides good performance gain over traditional ASP.NET Web Forms.1 point ASP.NET MVC.
Planning to reuse the same input logic?
If yes stick with MVC.
Conclusion
I think you should have equipped with enough information to make a decision what is best for your project. The complete decision depends on your team and project requirement.
Hope all of you enjoyed reading this article. Thank you for the patience.
For technical training related to various topics including ASP.NET, Design Patterns, WCF and MVC contactSukeshMarla@Gmail.com or at www.sukesh-marla.com
For more stuff like this click here. Subscribe to article updates.
WebForms vs. MVC
Start from the beginning
