Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ASP.NET Web Forns or ASP.NET MVC

Posted on 2013-06-30
6
Medium Priority
?
482 Views
Last Modified: 2013-08-19
Hello Experts,

I have developed ASP.NET web applications for years now using ASP.NET Web Forms while using ADO.NET to interact with a SQL database.

My question i have is can someone tell me the difference between using Web Forms and MVC to develop and interact with an SQL database and the pros and cons or each or at least why and for what reasons to use each?
0
Comment
Question by:asp_net2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39288655
Web Forms was created to help non-web programmers ease into development for the web. If you've ever done Win Forms development, then you know how similar the programming models are. The downside to all this "ease of use" is that a lot of extra cruft gets packed into your pages to help make that model work. Things like View State and all of the extra markup that helps a page determine which button was clicked...that all adds extra data to your pages. Web Forms tends to be larger in terms of payload to the client.

MVC is designed to be more light weight. You no longer have the TextBox, Label, ListBox, etc. controls that Web Forms has; instead you have the standard HTML controls that Web Forms ultimately turns all of its controls into (at page render). MVC doesn't require all of the View State and control tracking that Web Forms does. It functions on the premises that the original web was designed with.

All that said, you can accomplish a good separation of concerns with either approach. It's all in how you style your application. MVC, IMO, lends itself more to adhering to n-tier architecture. After all, ASP.NET MVC is just Microsoft's implementation of the MVC pattern. This is a pattern which by definition creates a separation of concerns between the various parts of your application.

Personally, I have come to like MVC much more than Web Forms. I appreciate the ease of throwing together a web site/application that Web Forms offers. But MVC is very clean in terms of the code and markup. Also, an expansion of MVC called Web API allows you to build RESTful services in an MVC style, very quickly, and very cleanly.
0
 
LVL 4

Author Comment

by:asp_net2
ID: 39288711
Hi Kaufmed,

Thank you for that information. So it sounds like neither is better than the other. I really enjoy working with Web Forms but have not tried MVC yet. I would prefer to just stick with what I have been using for years now. I truly enjoy working with design, programming ASP.NET controls, and programming using ADO.NET.

I was just curious if MVC was better than Web Forms or at least ask if MVC offered more options than web forms.

So I would not be able to work directly with the ASP.NET controls or the different Page Events if I used MVC then???
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 39288872
MVC is definitely better than web forms if you plan to do TDD and have concern in regards to Separation of Concerns (SOC)

As for you latest question, you are correct. you cannot using web controls or event driven server controls in MVC project.
You can however use a hybrid project where you can use both MVC and Web forms technologies on the same project.

An advice for your own career, learn MVC... No one is looking for web forms developers anymore (I run a development team and I wouldn't consider a resume if MVC experience isn't listed)

Good luck
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 4

Author Comment

by:asp_net2
ID: 39290531
@sammy1971,

>> An advice for your own career, learn MVC... No one is looking for web forms developers anymore

Why is that? I don't see a TRUE benefit to use MVC over Web Forms. It seems more like user opinion. It also appears that you are limited to what can be done programming wise with MVC than Web Forms or maybe I'm wrong. It seems that Web Forms gives you more interaction with the ASP.NET Controls and Page Events when needed.

I just don't understand the sole purpose of MVC and why some say it's better than Web Forms.

Can someone help me understand in lamens terms why MVC is or is not better than Web Forms?
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 2000 total points
ID: 39292163
I've been developing in ASP.NET for 10 years.  I can definitely say I like the MVC model better than webforms.

As well as the reasons posted above by kaufmed, in MVC:
The page lifecycle is simple, unlike webforms
Cleaner HTML, therefore easier to write javascript.  Easier to integrate javascript libraries such as jquery, meaning less reliance on third party controls.
The abstraction is moved from complex web controls to the binding layer  (Once you see this in action, you'll understand why it's genius.)  Your plain old HTML binds automagically to the model object.
Instead of having messy HTML and a sometimes functional event model, you get streamlined HTML and clean object data being posted back to the server.

AJAX is straight forward.  You use javascript and call a method in your controller.
But your mileage may vary.  Also what becomes popular in software development isn't always about what's better.  Often it's about what is new and shiny and cool.
0
 
LVL 27

Expert Comment

by:Sammy Ageil
ID: 39292172
Due to the level of abstraction involved in webforms,  it tends to get abused by lazy developers.
This abstraction doesn't exist in mvc, it's just simply developed to follow Web protocols. I have developed in both mvc and Web controls since the release of framework 1.1.
It's simpler, cleaner and more extendable.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question