10

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.

Brian G
  • 53,704
  • 58
  • 125
  • 140

5 Answers5

13

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.

swilliams
  • 48,060
  • 27
  • 100
  • 130
  • asp.net 4.0 now allows routing. Personally, I handled this with my HttpModule but, now it's built in. – bbqchickenrobot Oct 01 '10 at 04:14
  • 3
    Probably the most important thing is that MVC embraces HTTP while WebForms does a good job of abstracting it away. – Omar May 27 '11 at 17:20
8

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

user_v
  • 9,628
  • 4
  • 40
  • 32
2

The video tutorials here help describe the differences.

Quintin Robinson
  • 81,193
  • 14
  • 123
  • 132
2

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.

Elijah Manor
  • 17,923
  • 17
  • 72
  • 79
0

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.

See more..