ASP.NET MVC vs ASP.NET WebForms

In this article i am explaining mazor different   between Asp.MVC vs Asp.Net Web Forms.

ASP.NET WebForms

  1. ASP.NET Web Forms uses Page controller pattern approach for rendering layout. In this approach, every page has it’s own controller i.e. code-behind file that processes the request.
  2. No separation of concerns. As we discussed that every page (.aspx) has it’s own controller (code behind i.e. aspx.cs/.vb file), so both are tightly coupled.
  3. Because of this coupled behavior, automated testing is really difficult.
  4. In order to achieve stateful behavior, ViewState is used. Purpose was to give developers, the same experience of a typical WinForms application.
  5. Statefulness has a lots of problem for web environment in case of excessively large ViewState. Large ViewState means increase in page size.
  6. ASP.NET WebForms model follows a Page Life cycle.
  7. Along with statefulness, microsoft tries to introduce server-side controls as in Windows applications. Purpose was to provide  somehow an abstraction to the details of HTML. In ASP.NET Web Forms, minimal knowledge of HTML, JavaScript and CSS is required.
  8. Above abstraction was good but provides limited control over HTML, JavaScript and CSS which is necessary in many cases.
  9. With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach.
  10. It’s good for small scale applications with limited team size.

ASP.NET MVC

  1. In ASP.NET MVC use Front Controller approach. That approach means ,a one  common controller for all pages, processes the requests.
  2. Very clean separation of code. View and Controller are neatly separate.
  3. Testability is key feature in ASP.NET MVC. Test driven development is quite simple using this approach.
  4. ASP.NET MVC approach is stateless as that of the web. So here no concept of ViewState.
  5. As controller and view are not dependent and also no ViewState concept in ASP.NET MVC, so output is very clean.
  6. No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model.
  7. In MVC, detailed knowledge of HTML, JavaScript and CSS is required.
  8. Full control over HTML, JavaScript and CSS.
  9. It’s a step back. For developers decrease in productivity.
  10. It’s better as well as recommended approach for large-scale applications where different teams are working together.

Leave a Reply

Your email address will not be published. Required fields are marked *