The product of a web developer with a little too much caffeine

WebForms : FrontPage For Programmers

with 9 comments

Yeah – I said it. I called WebForms FrontPage for programmers – whadaya goin’ to do?

Now before people start throwing hate mail at me its worth pointing out that up until MVC I used WebForms for all of my web development. In fact, I really do like WebForms. I think that they are especially great for whipping out quick internal projects that normally draw away from the time you could use developing something useful.

But, as much as I like WebForms, I think that too often they spew out more crap than value. If FrontPage was the way for a non-technical person to make a website then WebForms is the way for a non-web developer to make a website.

A Simple Example

(It’s worth noting my measurements are based on uncompressed HTML – I’m mostly pointing out the differences between output created by the developers – not the content that is compressed down the wire.)

Well here is a page that really rubs me wrong…



Why? Nothing bad about it – the page looks pretty good… until you look under the hood at the source code. Once you start digging into it you find that the page is a whopping 123K and of that 28K is in the ViewState — clearly something that could have been done away with. You can also tell that ASP.NET gave a bunch of the elements on the page a unique ID even though they aren’t going to be referenced by any sort of Javascript. How about the id ctl00_BaseBody_FadingHeroEmbeddedSliverlight1_FadingHeroEmbeddedSL_ HeroBottomTitleShortDescriptionDivID (I had to put a break in the middle).

ASP.NET really does an incredible job abstracting the web so that a desktop programmer can jump right into web development, sometimes even using drag-and-drop controls *shudder*. It seems to me that web development ought to be done by people that understands the model.

Here is an example where you can tell that web developers had constructed it. It pains me to show it but I think it is relevant here since they are direct competition.



Yeah, it’s the website of the enemy. But if you go over the page there is roughly the same amount of information (if not more) but their page is only 25K (smaller than the ViewState alone on the previous example). Even if you compare all of the resources on the two pages, the Apple site loads about 30K less in stylesheets and scripts than the Microsoft site. It is worth mentioning that the Apple site does load more images but their entire pages is full of large, high quality images — which is something that grabs attention much better than text. Not only that, but the Apple site actually does stuff!

Why? If you look at the source code you can an immediate difference between the two. The source code on the Apple page is cleaner, better designed and smaller. There is no ViewState or unnecessary ids for elements on the page. Everything (appears) to have been placed onto the page through careful consideration and not generated by some Page Lifecycle that injects code and markup into your page without you even knowing it.

So What Is My Point

Both these examples are two high profile sites. They are from two very competent technology companies — however, one looks a little less skilled to the other – at least from a web development perspective. It seems to me that extra time and effort should have been placed by the Microsoft developers to trim out all the fat and make it as web friendly as possible.

I might be nit-picking at the HTML output but I do think its relevant. That code – even if it is compressed – is the final rendered output from a WebForms page. As soon as the page opens there is immediately markup errors, unmatched tags, extra body elements. It’s clearly not the best it can be. I’m not trying to make Microsoft look bad either – personally, I want to work for them some day, but the point is that in order to improve then you must first be honest with yourself and those around you.

WebForms are a powerful tool – don’t get me wrong – but it seems to me that they have abstracted web development too far. I always thought it was really cool about .NET the way you could go from web, desktop, console, mobile or whatever development you wanted to and it was still like second nature! It allowed you to focus on solving problems and less on how each area was supposed to work.

I’m not saying people can’t develop great applications with WebForms. In fact I still use them from time to time when I need to hack out a quick application that only the internal eyes of my company are going to see. However, when I’m browsing the web and come across a website that is packing a 50K ViewState or is littered with wasteful, pointless 40 character long ids, I just can’t help but feel that WebForms is starting to hurt the web a little.

That’s why I recommend that if you haven’t already, go try out ASP.NET MVC. It doesn’t take long to break away from WebForms and you’ll probably feel more comfortable within a few days.


Written by hugoware

August 28, 2009 at 2:12 am

9 Responses

Subscribe to comments with RSS.

  1. Agreed on all points, but .Net 4 allegidly has functionality to help webform developers get a better handle on viewstate and element id lengths. Viewstate as much as I hate how it is abused, can be useful.

    Some Random Dude

    August 28, 2009 at 8:37 am

    • True, I’ve heard about some of the controls you have over the IDs that get dumped out on your page. I really haven’t read that much about it (maybe I ought to get caught up :))

      Personally, I think the ViewState really is a good idea – I think the part where it falls apart is that everything thinks its information needs to be saved there (like I think Labels use it – why??).

      Hopefully you’re right and the new functionality in .NET 4 will clean up some of this mess.



      August 28, 2009 at 8:55 am

  2. […] to VoteWebForms : FrontPage For Programmers (8/27/2009)Thursday, August 27, 2009 from webdev_hbYeah – I said it. I called WebForms FrontPage for […]

  3. WebForms : FrontPage For Programmers – Hugo Bonacci…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…


    August 31, 2009 at 12:28 pm

  4. As a webforms developer I dont want to give up this model just yet. I dont want to throw away the last 3 years of knowledge just because a new templating engine has come out.

    I know everyone is acting like we should all be rounded up and shot but do you think my employers will agree when it means I have to rewrite everything i create from now on rather than re-using from a previous project?

    I dont think its really time for me to give up on the technology quite yet because a lot of the advantages of MVC are evaporating in .net 4.0.

    You have control over generated ID’s, you can customise your viewstate on page and control level, you can use routing, the controls will all support css based markup instead of table based. Telerik and others have launched web ui testing frameworks.

    Another thing I dont like about MVC is that it throws out the standards we are used to. Instead of a gridview or listview we are now faced with every developer going off and getting their own table solutions so you have yahoo tables, jquery tables, custom tables, different view engines. This means you have to relearn everything each time you come to look at a project. It also means you have varying levels of quality when it comes to documentation.

    I do like the idea of separating my code out and following best practices and all the things you should be into if you want to be proud of your job but it seems like MVC hasn’t matured yet.

    I heard that Telerik have released some reusable controls for MVC.
    if this trend continues and we can recreate the RAD part of webforms but drop the nasty bits then count me 100%


    September 2, 2009 at 7:57 am

    • I hardly think anyone using WebForms should be shot… (at least not shot more than once) 🙂

      WebForms can create elegant solutions to problems quickly and easily, I won’t argue at all with you on that point. But WebForms really is like FrontPage in the sense that the output is normally littered with a lot of extra garbage.

      For some programmers web programming knowledge is to drag a databound grid control onto a page; They have no idea what they should do to further optimize a website — much like some sweet old grandma using FrontPage to make a website about her cats doesn’t know about web optimizations.

      I’d say that internal apps can be as cluttered and messy as you want – they’re internal apps – who cares!. But if you’re working on a public website then all the fat needs to be trimmed out, which is something that MVC excels at.

      I do miss WebControls a lot in MVC – I’ve actually done other posts to try and bring some of the functionality back. Personally, I think that Controller logic makes a lot of sense – but not for handling the UI. In some ways I think MVC should embrace using the existing Page Lifecycle with regards to handling controls on the page – but that is a post for another time.

      Thanks for your comment! If you’re a web developer that realizes that WebForms spews out crap that you need to clean up then you aren’t really who I’m talking about 🙂


      September 2, 2009 at 8:38 am

      • Hehe, well yeah I fully agree that the web should be kept tidy.

        Before I started on the path of .net every site I made was fully w3 compliant, not a table in sight, semantic markup, accessible stylesheets, print stylesheets, cross browser tested, nicely tabbed up, extra meta info in the top, the works!

        I see where youre coming from because when I moved over to I cringed at the pretend validation I had to accept (valid w3c but with tables dotted around, extra rubbish etc).

        I basically told myself I have enough to learn with and I could worry about perfecting the markup afterwards. I still did everything I could such as the cross browser testing and creating clean code where it was my work.

        MVC should have been the solution to this problem for the early previews I read every post and did all the tutorials.

        Then MVC came out and I didnt want to make the jump. It feels like a massive change in the way we work just for a small benefit of cleaning up the html code. Its a lot to ask for something that only really makes us developers feel a warm glow – it doesnt have any business benefit to the majority of our clients.

        I have seen the analytics logs and while I am conscious of blind users and mobile users it doesnt represent a portion of the market that I can invest this much effort in to fix. Just as I dont optimize for IE5.5 or Konquerer.

        Do you have any opinions on the comments I have made about everyone using their own solutions / no standards with view engines, roll your own gridviews, etc? Am I right about this? Its just an observation from the outside looking in at this point.

        My entire post is probably a terrible stance to take but I am just looking for the concrete reasons to change my mind.


        September 3, 2009 at 4:54 am

      • I’d say that if you’re doing your part to minimize the clutter of then no need to change. I have websites I did in ASP.NET and I’m not going to redo them just because MVC is here.

        At my job I work with a lot of vendors that appear to be competent programmers but lousy web designers. You can see that they wrote some really good software but then used WebForms (with absolute-position buttons and labels – eww!) for the UI. They really ought to understand the whole “WWW” thing before they convert their app to a web app.

        It isn’t just W3C validation either – think of all the security holes introduced because some ASP.NET abstraction hid some of the complexities of “real” web programming.

        As for MVC and the lack of standards – I think that is mostly due to the fact that MVC is so new that a lot of people are trying to set the standard. I suspect a lot more new frameworks and toolkits will appear for MVC — and then the quality ones will prevail and the others will fade away (think of ASP.NET AJAX – just sayin’ ;))


        September 3, 2009 at 11:13 am

  5. […] Pick of the week: WebForms – FrontPage for Programmers […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: