Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the key differences between ASP.NET webforms and MVC

I know what MVC is and I work in webforms but I don't know how MVC will be that much different. I guess the code behind model will be different. So will it be like webforms minus the code behind and instead having it in a controller?

I see there are other related posts but I don't they address this.

like image 761
Brian G Avatar asked Sep 26 '08 21:09

Brian G


People also ask

What is the difference between ASP Net Web Forms and ASP.NET web pages?

Yes, there is a major difference between the Web Pages framework and Web Forms. Web Forms uses server controls and the programming experience is more like working with Windows Forms and controls. Web Pages is very much like PHP or classic ASP and lets you work much closer to HTML and HTTP.

Which is better Web Forms or MVC?

More Control-The ASP.NET MVC framework provides more control over the HTML , JavaScript and CSS than the traditional Web Forms. Testability-ASP.NET MVC framework provides better testability of the Web Application and good support for the test driven development too.

What is webform and MVC?

Webforms are MVC are two development styles available in ASP.NET. The difference between Webform and MVC is that the Webform follows a traditional event-driven development model while the MVC follows a Model, View, and Controller pattern based development model.


4 Answers

For starters, MVC does not use the <asp:control> controls, in preference for good old standard <input>'s and the like. Thus, you don't attach "events" to a control that get executed in a code-behind like you would in ASP. It relies on the standard http POST to do that.

It does not use the viewstate object.

It allows for more intelligent url mapping, though now that the Routing namespace has been spun off, I wonder if it can be used for WebForms?

It is much easier to automate testing of web parts.

It allows for much easier separation of UI logic from the "backend" components.

like image 194
swilliams Avatar answered Oct 14 '22 04:10

swilliams


Difference between ASP Net Webforms and ASP Net MVC

The image says it all.

Update: Adding the original link for completeness. http://forums.asp.net/t/1528396.aspx?MVC+vs+Web+Forms

like image 34
user_v Avatar answered Oct 14 '22 06:10

user_v


The video tutorials here help describe the differences.

like image 26
Quintin Robinson Avatar answered Oct 14 '22 04:10

Quintin Robinson


There is so much that can be said about your question.

MVC allows for clean separation of concerns, testability, and test driven development (TDD). It supports clean RESTful URLs and is very extensible... meaning you could swap out of the viewing engine, the routing mechanism, and many other things that you might not like out of the box.

For additional information I would suggest reading Dino Esposito's blog post entitled An Architectural View of the ASP.NET MVC Framework. Inside this post he compares many differences between the classic code behind approach with MVC.

like image 43
Elijah Manor Avatar answered Oct 14 '22 05:10

Elijah Manor