views:

79

answers:

2

Hey

I have developed a webapplication in both ASP.NET MVC and ASP.NET Webforms and i'm wondering isn't Webforms following the rules of the MVC Pattern just the as ASP.NET MVC is?

I mean we have the .aspx file which holds the visual (HTML and JavaScript) and then the code behind file which controls the user interaction and data for the .aspx file. Then we could make a Repository lager for fetching and doing stuff with data.

Isn't this the same as following the rules of the MVC Pattern? View for visual, Controller for controlling user interaction and data for the Views and the Model fetching and doing stuff with data?

I know ASP.NET MVC and Webforms handles Postbacks and URL handeling differently, but im not comparing the two ASP.NET techniques, but the MVC Pattern in generele for the two techniques.

+3  A: 

ASP.NET Webforms is definitely not following the MVC pattern.

In MVC you have three elements, the Model, the View, and the Controller.

In ASP.NET Webforms, you have your Page (codebehind and the markup are compiled into a single object, not seperate), and whatever data is being shown. You really have no controller. You make a requrest directly to the page rather than a controller and the page is responsible for both working with the data and rendering the page. Definitely not seperated like MVC would be.

Justin Niessner
Thanks. Just the answer i was looking for.
Poku
A: 

Just the fact that you're not using the codebehind in your aspx page should give you a hint that there are some pretty substantial differences between MVC and webforms... You aren't using the codebehind, are you?

Not to mention how hard it is to test a Webforms page.... You are testing your code, right?

Will
+1, I like the sarcasm.
Darin Dimitrov
This is not an answer to the question: you are only giving some hints.
Jan Willem B