In this article i am explaining mazor different between Asp.MVC vs Asp.Net Web Forms.
- 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.
- 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.
- Because of this coupled behavior, automated testing is really difficult.
- In order to achieve stateful behavior, ViewState is used. Purpose was to give developers, the same experience of a typical WinForms application.
- Statefulness has a lots of problem for web environment in case of excessively large ViewState. Large ViewState means increase in page size.
- ASP.NET WebForms model follows a Page Life cycle.
- With a lots of control libraries availability and limited knowledge of other related technologies, ASP.NET WebForms is RAD(Rapid Application Development) approach.
- It’s good for small scale applications with limited team size.
- In ASP.NET MVC use Front Controller approach. That approach means ,a one common controller for all pages, processes the requests.
- Very clean separation of code. View and Controller are neatly separate.
- Testability is key feature in ASP.NET MVC. Test driven development is quite simple using this approach.
- ASP.NET MVC approach is stateless as that of the web. So here no concept of ViewState.
- As controller and view are not dependent and also no ViewState concept in ASP.NET MVC, so output is very clean.
- No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC model.
- It’s a step back. For developers decrease in productivity.
- It’s better as well as recommended approach for large-scale applications where different teams are working together.