Difference Between ASP.NET Webform and ASP.NET MVC

Learn Dot Net Programming from basics – FREE MICROSOFT DOT NET TUTORIAL

ASP.NET Framework is a part of .NET platform for building, deploying and running web applications. Now, we can develop a web application by using Asp.Net Web Form and Asp.Net MVC. Before we proceed to discuss about the differences between Web Forms and MVC, we need to know the concepts of ASP.NET Web Form and ASP.NET MVC.

ASP.NET Web Forms


ASP.NET Web Forms developed by Microsoft to manage state and form data across multiple pages. The ability of the web are state-less pages where Microsoft created stateful pages by creating the Web Forms technique.

ASP.NET MVC


An open source web application framework that implements a Model View Controller design pattern. The ASP.NET MVC framework is a lightweight and testable framework with existing asp.net features such as master pages, authentication, etc and it will split application into three components Model, view and controller.

With that cleared up lets go over the differences between Asp.Net Web Forms and Asp.Net  MVC.

S.No Asp.Net Web Form Asp.Net MVC
1 Asp.Net Web Form has server controls. Asp.Net MVC has HTML helpers.
2 Asp.Net Web Form has Master Pages for consistent look. Asp.Net MVC has Layouts for consistent look.
3 Asp.Net Web Form is not Open Source. Asp.Net Web MVC is an Open Source.
4 Asp.Net Web Form has User Controls for code re-usability. Asp.Net MVC has Partial Views for code re-usability.
5 Asp.Net Web Form follow a traditional event driven development model. Asp.Net MVC is a lightweight and  follow MVC pattern based development model.
6 Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access. Asp.Net MVC is lightweight and provide full control over markup and support many features that allow fast development.
7 Asp.Net Web Form supports view state for state management at client side. Asp.Net MVC does not support view state.
8 In Asp.Net Web Form, Web Forms – ASPX i.e. views are tightly coupled to Code behind – ASPX.CS i.e. logic. In Asp.Net MVC, Views and logic are kept separately.
9 Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physically existence. Asp.Net MVC has route based URLs  that means URLs are splited into controllers and actions .
10 Asp.Net Web Form follows Web Forms Syntax. Asp.Net MVC follow customizable syntax (Razor as default).

 

Points to Remember :


  • Web Forms has ViewState, MVC does not.
  • Web Forms has a Code-Behind Model where MVC just has models.
  • Web Forms has IsPostBack where MVC has a GET and…well…a POST.
  • Web Forms has State-aware components where MVC uses more of a template approach.
  • Web Forms is not testable-friendly, MVC was built around tests.