Microsoft ASP .NET MVC vs Web Forms

The world of Web Development is a rapidly changing one. In this constantly evolving world, Microsoft has 2 products to offer -the ASP.NET Web Forms and MVC. We compare how they fare against each other.

What is ASP.NET?

It is Microsoft’s Web Application framework. It uses one of the programming languages such as C#,VB .NET, etc. for building dynamic websites. Development models supported are Web forms which is a classic and seasoned Rapid Application Development Framework and ASP .NET MVC which is comparatively new and is Microsoft’s solution conforming to the contemporary MVC architecture.

ASP .NET Web forms

The basic problem that it tackles is to provide a virtual state fullness to the stateless web and rapid application development environment for developers. It provides rich server side controls and supports event driven programming. This requires a little knowledge of concepts of web development as most of the internal details are taken care of by the framework.

It builds abstractions around the stateless web by supporting code behind, view state and post back mechanism on the related code behind. So the developers need not be concerned about how the web functions internally.

Although a lot of development has been done using this framework, but many loopholes have surfaced over the years. Some major drawbacks are

  • Very less modularity and separation of concern in architecture.
  • This makes unit testing very difficult due to which maintenance of the project takes a hit.
  • Very less control over html and hence designing and supporting JavaScript.
  • Heavy use of view state results in slow performing websites.
  • There is hardly any reusability of code and therefore a lot of repeated effort is required.
  • Search engine optimisation is difficult to do as the URLs are not easily configurable.

ASP .NET MVCMVC stands for Model View Controller.

  • Model consists of the business logic
  • Controller is used for routing and interaction of view with models.
  • View is the user interface of the application and consists of the presentation layer.

This development paradigm was popularised by Ruby on Rails and is widely used today because of its clean demarcation of functionality and its separation of concern.

Microsoft released its own MVC Framework in 2007 to tackle some basic problems in web development such as to provide a separation of concern, code reusability and supporting test driven development and unit testing. It fully supports Object Oriented design and overcomes some basic flaws of Web Forms.

  • Clean folder structure and functionally separated blocks.
  • Easy testability of code.
  • Full control over HTML so that JavaScript and other front-end technologies can be easily integrated.
  • Through URL routing, URLs can be configured for search engines and better readability.
  • High Performance achieved as view state is not so prominently used.
  • Easy maintenance and reusability of code.
  • Razor View Engine provides easier and strict model conforming development.

Conclusion

Both these frameworks have their own set of pros and cons.

MVC requires a thorough understanding of the web Development concepts and object oriented architecture design, and provides a slower development speed but can be integrated easily with other technologies. Whereas web forms provides rapid application development and it has a lot of documentation available.

For selecting one of these, one should also keep in mind the project requirements and the expertise of the team. A good team can build great solutions using any of these technologies.

Mahendra Singh is an Application Developer at Compassites. He has a 1 year of experience in building ASP .NET applications in various domains ranging from eCommerce to Online Education sites.He enjoys trying out new and emerging technologies.He has done his Engineering in Computer Science from BIET Jhansi. He is a fitness enthusiast and loves watching football.

Leave a comment