Brian G
Brian G

Reputation: 54992

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.

Upvotes: 10

Views: 12540

Answers (5)

parijat mishra
parijat mishra

Reputation: 45

Asp.Net Web Forms:

  1. Asp.Net Web Form follows a traditional event driven development model.
  2. Asp.Net Web Form has server controls.

Asp.Net MVC model:

  1. Asp.Net MVC is a lightweight and follow MVC (Model, View, and Controller) pattern based development model.Asp.Net MVC does not support view state.

Upvotes: 0

user_v
user_v

Reputation: 10114

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

Upvotes: 8

Elijah Manor
Elijah Manor

Reputation: 18023

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.

Upvotes: 2

swilliams
swilliams

Reputation: 48890

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.

Upvotes: 13

Quintin Robinson
Quintin Robinson

Reputation: 82325

The video tutorials here help describe the differences.

Upvotes: 2

Related Questions