The ASP.NET Code Behind Whitehouse.gov 143
An anonymous reader writes "The author looks at the markup for the new whitehouse.gov site, launched today. It uses ASP.NET and various JavaScript libraries. It suffers from various inefficiencies, most easily remedied. Check the images and techniques used to build the site front-end."
Maybe we can (Score:3, Insightful)
Hmm... Freudian slip? FWIW, most of the whitespace is probably generated by the ASP technology they used. Spots where code goes can often generate unexpected whitespace. It's just a side effect of using scriptlet-type technologies.
Don't get me started on the "correct" way to write ASP. The tag-substitution gobbldy-gook encourages all kinds of bad page-development practices. The request-time attributes + templating taglibs seen in JSP provide a much cleaner separation between logic and HTML.
Ouch. Welcome back to 1996. Web developers looking for the smallest file size really need to learn that there is such a thing as palletized PNGs. They're even smaller than GIFs, even.
This is one place where my reaction is "BFD". As long as it looks acceptable under most circumstances, the people with the carefully color calibrated monitors (*cough*yeslikeme*cough*) can suffer a bit. Heck, half the JPGs on the internet look like garbage, so I'm not too worried about artifacting in the gradients.
Can we choose the right technologies for a website? No we can't! Thankfully, the President isn't hired to choose the best technology to run his website. ;-)
The fact that he uses them makes them the best. (Score:1, Funny)
The fact that he uses them makes them the best.
As of today, IIS6 is the best web server and ASP.NET 2.0 is the best web application framework.
Re:The fact that he uses them makes them the best. (Score:4, Insightful)
Technically its the same server and software that was on whitehouse.gov yesterday under the Bush Administration. Like the Defense Secretary, keeping the stuff that works and would be a hassle to change around for right now.
PNG/GIF i'll forgive (Score:2)
But I agree with the heavy jpeg compression. It is one of my pet peeves, actually. Especially when people use JPEG's for images that really should be GIF's.
And yes, PNG's are smaller but I've found that IE6 can do weird things to them. Even IE7 can sometimes do funky things with the colors in PNG images. And don't forget you can't easily do transparent PNG's until IE6 is finally flushed out of our system (if you are reading this and are using IE6, please upgrade for the love of god).
Re: (Score:1)
Many, many ASP.NET sites use URL rewriting. http://www.yafla.com/dforbes/The_Best_And_Worst_of_2008/ [yafla.com] goes to an aspx page. http://www.yafla.com/dforbes/Could_Microsoft_be_the_Patron_Saint_of_Firefox/ [yafla.com] goes to the same aspx page, albeit with different parameters.
ASP.NET MVC brings a nice model, but it certainly wasn't first to rest-ful URL rewriting.
Re: (Score:2)
256 color PNGs work correctly in IE6 [johndyer.name]. No need to do anything special.
Put pngfix.js [ntlworld.com] in an IE conditional tag if it bothers you. I refuse to stop the progress train because of Microsoft's ill-gotten monopoly.
I confess, I haven't used ASP.NET 3.
Re: (Score:3, Insightful)
The PNG hack for IE6 has some rather fatal drawbacks, particularly if you want to use it to replace background images instead of just regular <img>s. The most obvious issue is the z-index one, in that the PNG hacked PNG is rendered on a layer on top of the canvas, for which no events (including clicks) will pass through, unless you throw in a lot more hacks and you're really lucky. The other more insidious problem is that any element with a PNG hacked PNG must have layout, meaning it's almost guarante
Re: (Score:1)
Fair enough. On the sites I used pngfix, I haven't run into these issues. Of course, these days I've started "firing" customers who use IE at all. Hobby sites are tons of fun that way. Wish I could do that at my day job. ;-)
FWIW, everything in the article is about marginal improve
Re: (Score:2)
Hold off on the ASP.NET MVC stuff for now. It's really a pathetic implementation at this point.
Stuck with only basic HTML controls, nearly none of the more advanced ASP.NET controls work, as most continue to rely heavily on ViewState which isn't supported with the MVC framework.
So until they convert most of the advanced controls, it's just going to create more work to use it.
Worse than Ruby on Rails for now, but give them time...
Re: (Score:2)
Re: (Score:2)
I was about to call you crazy until I looked it up. IE6 was released August 27, 2001. Not a decade yet, but damned if it's not going on eight years.
Wow, I am getting old. Thanks for the reminder. :-)
Re: (Score:2)
Re: (Score:1)
Every hear of the boy who cried wolf?
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:1)
I confess, I haven't used ASP.NET 3.5/MVC yet. It would have been handy back when I inherited an ASP.NET project. Unfortunately, after my poor experiences with ASP.NET's scalability (or lack thereof), I'm not really inclined to develop another site in ASP.
You mean since you lacked the knowlege to properly scale and Asp.Net application.
Re: (Score:2)
Re: (Score:3, Insightful)
The request-time attributes + templating taglibs seen in JSP provide a much cleaner separation between logic and HTML.
Wait, are you serious? JSP is no better than classic ASP; it's arguably quite a bit worse than classic ASP since it isn't language agnostic. JSP is a defunct and outstandingly annoying technology to work with that encourages all sorts of bad habits.
You might consider checking out Tapestry 5 [apache.org] for something a little more this century.
Re: (Score:3, Insightful)
Language agnostic is pointless when you're not writing code. Correctly written JSP 2.0 files should have no scriptlets in the pages. All the code should be in behind-the-scenes APIs or in parent servlets that use the page for rendering. The JSP solution is far more flexible than the ASP page-backing code files solution, and generally encourages better written code. Looking at ASP.NET pages th
Re: (Score:2)
Whatever helps you make it through the day
In comparison to Tapestry or Wicket, JSP is defunct, you really can't deny that.
Re: (Score:2)
Oh for the love of God. You have no idea what you're talking about.
http://java.sun.com/products/jsp/ [sun.com]
Use JSTL. Don't use JSF. There, good to go.
I was there when the first version of Tapestry was introduced the internet. It was an interesting idea, but it took quite a few revisions to make it into something useful. Today it's an alternative to JSPs for rendering, but it by no means retires the use of JSPs. Same with Velocity and Wicket. And if you try to introduce me to Spring as if it's the latest and greate
Re: (Score:2)
Re: (Score:2)
FWIW, you should probably start with Glassfish (aka Sun Java System Application Server) and Netbeans. That combination is extremely smooth for J2EE development and will have you up and running in no time flat. (Plus it's all open source. ;-)) Just visit Netbeans.org [netbeans.org] and grab the full version or the version with Glassfish bundled.
Once you get it setup, you can configure features like the JDBC connections through the admin console o
Re: (Score:3, Interesting)
This isn't entirely true. For example, you can have normal ISO C++ compile into pure MSIL - VC++ does that (if you use /clr:pure). When you look at the features the runtime provides, it's pretty obvious: it has raw data and function pointers, arbitrary-layout st
Re: (Score:2)
If you mean the lack of functors - yes, they did miss that, but that's just one bit of the language. And, of course, it's still quite possible to implement full OCaml on top of .NET, including functors - it's just that F# decided not to do that particular feature.
On the other hand, Don said that we should expect full-fledged type classes sometime in F# 2.0... now that would be quite something.
As for the rest, Eiffel is quite different from C# (and Java, and the likes) - for one thing, it has full MI, which
Re: (Score:1)
I tend to agree and disagree, the fact is, whatever clever thing you think you can do with JSP can also be done with ASP.net or even ASP....if you know your programming of that language, webservices, API and even .exe calls can all be done by all these technologies.
If you want to trash talk one language, or another, be sure that you have a firm point.
That being said, I tend to like one over another purely because of the ease of use by the designer/utilities/tools associated with it. Komodo was cool for awhi
Re: (Score:2)
Re: (Score:1)
The tag-substitution gobbldy-gook encourages all kinds of bad page-development practices.
That "gobbldy-gook" generates valid XHTML, if you tell it to.
templating taglibs seen in JSP
Bwahaha... sorry. There are better templating engines than ASP.NET 2.0, but JSP is not one of them - not in a million years.
Re: (Score:3, Insightful)
So does every other page templating technology known to man. I can do it in ColdFusion if you ask me to. That doesn't make ColdFusion a particularly good language for scalable site development. Nor does it make ASP.NET anything special. And if I never see more code like this, it will be too soon:
Re: (Score:1)
Re: (Score:2)
We're talking about ASP.NET here, not pl
Re: (Score:2)
I can't think of any nice way to put this, so I'll just go with you fail it [slashdot.org].
Don't you get tired of typing .NET after everything? That's as obnoxious of a marketing scheme as putting "Sun Java" before every name.
Scriptlet technology is a core part of ASP.NET whether you like to admit it or not. Ideally it should not be used, but it is ther
Re: (Score:2)
Just look around for .aspx pages when you browse, you'll see plenty.
Matter of fact is, IIS6 has been good enough, and IIS7 is great - and that's what any competent admin who knows both Unix and Windows (and has seen the latter some time after W2K last time, and not in the 90s) will tell you.
Of course, you don't give any specific reasons why one should
Re: (Score:2)
Re:Maybe we can (Score:5, Informative)
Whilst I'm a fan of PHP myself, I have to say the new ASP.NET MVC framework is rather good.
It really does beat hands down anything in the PHP world in terms of how quickly you can get something up whilst maintaining quality. I'd argue partly this is because of the Visual Studio integration and the power of Visual Studio to start with.
I wouldn't ever build a live app. in web forms, but I could be pretty tempted with the new MVC framework I have to admit. The various PHP frameworks out there that perform a similar task such as CakePHP could learn a lot from it in terms of how quickly you can build with it without the usual sacrifice of quality of software you get with Microsoft's tools (again, web forms for example).
Of course, the thing is as well, the Microsoft platform is slowly getting better, Windows Server 2008 and IIS 7 really aren't that bad, performance isn't too much different to Apache/PHP now and security since .NET is much improved. Of course, Apache was always pretty good so to say IIS is improving doesn't mean much in that context but certainly combined with .NET MVC I think the whole LAMP platform needs to watch out. The various PHP frameworks like Cake could do things such as dropping the stupid cake bake crap that fails half the time on Windows and is pretty much undocumented (It has one page in the docs that don't explain much beyond what it's for). In contrast Symfony is absolutely fantastic on documentation and so is Zend, but it's still much more hassle, and there's still many more security pitfalls you have to keep an eye on vs. ASP.NET MVC.
I'd probably like Java, but I've never used it professionally, only academically so can't compare with that. At the end of the day though, my point is that with ASP.NET MVC I can build a high quality site much more quickly and with much greater confidence than I can with any PHP framework right now.
Re: (Score:2, Offtopic)
Did I say anything to suggest otherwise? As of right now, ASP.NET is ASP. Pointing out that they are different is like pointing out that Windows 95 != Windows XP when someone criticizes "Windows". Especially when "ASP.NET 2.0" is clearly spelled out in my post.
Now if you want to hear me complain about the inanity of ASP.NET 2.0 and 1.x being incompatible with each other, thus necessitating the need for both engines to run alongside each other in support of legacy modules, just keep it up. ;-)
Re: (Score:1)
thus necessitating the need for both engines to run alongside each other in support of legacy modules
I can think of several languages that have had such issues over the years ;). Anyhow, I'm a dinosaur... I still do 99% of my web development in Perl on Debian (mostly using a framework I wrote myself a couple of years ago plus a sprinkling of third-party tools). Whatever gets the job done...
Re: (Score:1)
Now if you want to hear me complain about the inanity of ASP.NET 2.0 and 1.x being incompatible with each other, thus necessitating the need for both engines to run alongside each other in support of legacy modules, just keep it up.
I think you fail to understand .Net, and why this is actually a good thing. Maybe you don't remember DLL hell? Side by side versioning is MS' solution to DLL hell, and many of the things that .Net 2 made incompatible were done because they were causing some serious problems in
Re: (Score:2)
I've been doing servlet code for over a decade. I can still take the code from one of those old applications and make it run in a modern J2EE server. No changes necessary.
The fact that Microsoft needed to make such radical changes after only a single release suggests that they have a problem with their engineering. No other server-side technology changes so radically between versions.
Being able to run original ASP alongside ASP.NET I
Re: (Score:2)
Somewhat correct. The key issue to keep in mind is that the spec is usually vetted to the point where the specification is correct. Sun then uses a test kit to ensure that VMs meet the specification. Sometimes an error is not caught and the implementation has to be updated. However, these situations are few and far between. They rarely affect code deployed using the APIs. (e.g. I once had an executable JAR file
inefficiencies (Score:2)
no way.
whitehouse.gov Blog? (Score:2, Interesting)
Not to mention ...
TUE, JANUARY 20, 12:01 PM EST
Change has come to WhiteHouse.gov
The first post on WhiteHouse.gov.
A "first post"?
Re: (Score:1)
Poster:Barry
Subject:Change Has Come
FIRST!!!!!
(Black president.)
Re: (Score:2)
Fixed.
Re: (Score:2)
I thought it would be the ever-popular:
Poster: AC :)
FRIED CHIKKIN!!!!
Re: (Score:2)
This page is a way (Score:5, Insightful)
for the author to show his superiority to the Internet. None of what he cites really matters.
Re: (Score:3, Interesting)
True enough. Indeed, the page in question actually validates as XHTML Transitional [w3.org] which is something that is remarkably rare [yafla.com] and shows a concern for craftsmanship.
Re: (Score:2)
Actually, merely using ASP.NET components for all markup will give you valid XHTML Transitional for ASP.NET 2.0+ with default settings. So no surprise there - it just means the guy who made the website knows how to use ASP.NET properly (well, maybe that's a surprise in and of itself, of course).
Valid XHTML (Transitional) (Score:1)
Indeed, the page in question actually validates as XHTML Transitional [w3.org] which is something that is remarkably rare [yafla.com] and shows a concern for craftsmanship.
I noticed that, too. The CSS however does not validate. Still I take your point. APS.NET is not the tool I would use, but they have done well with the tool of their choice.
Re: (Score:2)
Re: (Score:2)
Strange - it almost seems like you interpreted everything on that page as a criticism.
Helpful advice?? (Score:5, Insightful)
Many developers use the JQuery from Google's servers for improved performance and lower latency.
Is this guy serious? Advising Whitehouse.gov to use a remote server to serve javascripts?
Re: (Score:2)
The theory behind using the Google-served copies of JavaScript libraries isn't to reduce load on the whitehouse.gov servers, but to improve caching.
Since HTTP caching is URI-oriented, a browser can't tell whether whitehouse.gov/xyz.js is the exact same thing as mypetcat.com/xyz.js, but it can if both sites reference a copy stored at google.com/xyz.js instead.
Re: (Score:1)
The theory behind using the Google-served copies of JavaScript libraries isn't to reduce load on the whitehouse.gov servers, but to improve caching.
This is true, but it doesn't change the fact that it still introduces security/privacy concerns. The fact remains that if the remote JavaScript changes, the behaviour of all websites referencing it will change. The method by which it changes doesn't have to involve hacking Google (DNS hijacking (site-local or otherwise), HTTP cache poisoning, etc.), and changes don't have to be outwardly malicious to have unintended side-effects (AVG's LinkScanner, anyone?).
On the face of it, though, referencing JQuery fi
Re: (Score:2)
No, the idea is to get the script to the client faster, because most web browsers will only initiate two connections per site you're talking to. Serving different things off multiple different sites lets you download more than two things at once. See for example http://support.microsoft.com/kb/183110 [microsoft.com]
Re: (Score:2)
Re:Helpful advice?? (Score:5, Insightful)
Re: (Score:2)
Yes that's my point.
It's somehow disturbing to see people just so easily and readily trust Google.
Funny how we hardly trust cops who swore an oath to protect us, while we firmly believe in a corporate motto.
Re: (Score:2)
Well, I don't know about you, but I've never had google kill a member of my family and get its search engine buddies to cover it up.
I get what you're saying, but there's a visceral reason why many people don't trust thugs with a piece of tin on their chest, and I can't think of very many things google could do to inspire that level of raw hatred in its customers.
Re: (Score:2)
Google has never given me an expensive speeding ticket under suspicious circumstances.
Re: (Score:1)
Is technical efficiency the immediate goal? (Score:1)
Personally, I think the site does a great job in balancing usability, layout, and (most importantly) good content. Given the extreme time pressures they were probably under, I think they did a great job.
open sourced govt please (Score:1)
Re: (Score:2)
Re: (Score:2)
well at least it's not... (Score:4, Insightful)
Is it Valid? (Score:2, Informative)
Unfortunately...
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.whitehouse.gov%2F&profile=css21&usermedium=all&warning=1&lang=en [w3.org]
Re: (Score:2, Insightful)
I never really did the color comparison/validations on my pages although I can see how handy that information could be and I bet its pretty easily remedied.
What I am surprised about is that you mentioned its valid HTML. The article mentions the site uses .Net 2.0... its been my experience that most, if no
"...and has a focus more on appearance." (Score:2)
You mean like his entire campaign, and probably the "first 100 days?"
I believe government should be more like technology: it does not have to look good to work and, dammit, we would really prefer it work right out of the box!
Re: (Score:2)
No, I really did not overlook it, I just both rue and lament it.
New robots.txt file (Score:5, Interesting)
Re: (Score:2, Informative)
Obviously because of growth through the years. The same file in 2001 was pretty much empty [archive.org] as well.
Re:New robots.txt file (Score:5, Funny)
Disallow: /firstlady/behindthescenes/text
Can't wait to crawl that one.
Re: (Score:2, Funny)
That's only fair. He's the president for all the robot-american's also. They should be able to access the site as well.
And if you don't agree, you can "kiss my shiny metal ass."
Re: (Score:1)
That's only fair. He's the president for all the robot-american's also. They should be able to access the site as well.
Richard Nixon is the true president for robot-americans!
times are changing (Score:2)
Campaign servers ran open source (Score:5, Informative)
http://www.linuxjournal.com/content/open-source-force-behind-obama-campaign [linuxjournal.com]
My take is that the whitehouse.gov servers are run by the government and have to conform to DoD security guidelines, which have only relatively recently included Linux configurations for certain commercial distributions such as Redhat. So they probably don't have the freedom to redo the servers with whatever they could cobble together with talented volunteers for the campaign.
Anyway, we'll eventually see whether all this talk of change only runs skin deep.
CSS Sprites (Score:2)
The author states that CSS sprites are "somewhat involved to implement". Unless you're really new to CSS, it's very easy to do.
What I find sad is the poor choice of image formats, i.e. all the graphics of the blue border should have been in 24-bit PNG, not JPEG.
I do applaud them for having clean URLs. Most of them anyway. [w3.org]
I'm an ASP.NET developer... (Score:3, Insightful)
...and, admittedly, a pretty sucky one. I figured out html on my own and it's not the main thing I do at work, so I never learned how to do things "the right way", and neither did any of my co-workers, for the most part.
I do want to do things the right way, so I read articles like the one linked to in this story with interest. However, I get NOTHING out of them when they're written like this:
It's annoying to read someone going off about inefficient practices without telling you how to do it better.
"There is a way?" Nice. Thanks for sharing.
(Yes, the "[Search for 'X-Aspnet-Version']" is dead text, not a link to anything...)
It's like this with virtually every other tech problem I've ever tried to research... Zillions of pages of people complaining about a problem, suggesting fixes, or claiming that something they did fixed the problem, and very little in the way of actual, detailed information about the fix, how and why it worked, and what exactly the problem was that it solved.
Re: (Score:3, Informative)
First hit on Google. [devnewz.com] Remember to search only the "X-Aspnet-Version" (remove the quotes) part of that text. BTW, as efficiencies go, this is a pretty minor one. It matters for a site like whitehouse.gov because they're likely to get a few million visits per day. (At least in the short term.) Very few websites have that problem, so I wouldn't worry too much about it. :-)
Re: (Score:2)
(Yes, the "[Search for 'X-Aspnet-Version']" is dead text, not a link to anything...)
Of course it's not a link. It's an instruction that you ought to follow if you're interested in finding it out for yourself.
Re: (Score:2)
Of course, I can search for answers to questions using a search engine. It's not particularly effective though. It might be in this case, from what the other responder to my original post said, but that's not the point.
Probably better than 90% of the time when I try to search for "how do i..." or "I get [this] undesirable behavior..." I end up getting a lot of useless hits in the search results. Discussion boards where no one knows anything, everyone guesses, someone mentions that they fixed the problem
Engineering nerds, this is an example! (Score:5, Insightful)
You will encounter this sometimes in your life, and you better get used to it. Sometimes, believe it or not, things are done simply because they need to be done.
They don't spend a lot of time laboring over every little detail, they have a list of tasks and a deadline and they do their best to meet the deadline.
They anticipate that nerds who nitpick Battlestar Galactica episode continuity errors will likely come in and stroke their butter soaked neck beards and chortle about how this or that could be done better to achieve 5% faster page loads, or allow for translation into Swahili.
But, they get paid either way and in the grand scheme of things trying to impress anyone on Slashdot is probably pretty low on anyone's to-do list.
As someone who's argued with people about vi vs. emacs in the past, I can honestly say you guys have reached a new low both in wasting time, having no worthwhile point, and being worthless slashdot editors. The trifecta.
Re: (Score:1)
I hate you for providing that mental image.
Seemed to work for me... (Score:2)
I went to it today. All the links worked. It looked nice and professional. It loaded fast even though I'm sure it was getting hammered.
No complaints from a user.
At the end of the day. Who gives a shit if it's 30bytes less efficient. A hummingbird landing on a telephone line probably disrupts my DSL connection worse.
Re: (Score:2)
It's not YOUR bandwidth, it's about theirs.
What is this ignorance? (Score:5, Informative)
I just love when people who know nothing about ASP.NET attempt to critique things:
The whitehouse.gov site has long ASP.NET IDs. There are many elements on the page that have very long IDs, which are mainly a waste of bandwidth usually. They could be easily removed on the server side.
<a id="ctl09_rptNavigation_ctl00_rptNavigationItems_ctl01_hlSubNav"...
Sorry bud, they can't really be removed on the server side - these are controls embedded in controls embedded in controls. Maybe a slight shaving of rptNavigationItems down to rptNavItms or something, but the long name is to be able to reference the embedded controls.
Please try again...
Re: (Score:1)
Re: (Score:1)
Re: (Score:2)
Re: (Score:2)
Fix the problem now (Score:1)
Re: (Score:1)
Pick the low hanging fruit. (Score:3, Interesting)
Who cares about a 30 byte http header when your page is over 800k and ~45 requests, there's plenty of low hanging fruit to pick first. Interesting thing is in the post above a tool called the rpo is mentioned, it seems to do most of the important optimizations automatically.
Anyone try a DNS lookup? (Score:3, Informative)
$ host www.whitehouse.gov
www.whitehouse.gov is an alias for www.whitehouse.gov.edgekey.net.
www.whitehouse.gov.edgekey.net is an alias for e2561.b.akamaiedge.net.
Reducing their bandwidth and server load is just not a big deal. (See Akamai [wikipedia.org] and note that the whole site takes the path that the "image" request takes in that diagram.)
Found a bug (Score:2)
This is a classic one:
ASP.Net has built in defences against XSS which are enabled by default. Most sites will however only catch this on the last line of defence; the server-side request causing HTTP error unless manually handled or overridden. It looks like this site also doesn't do any input validation for tags either causing said errors.
Really, you need to switch off the XSS checking and instead HttpEncode all the inputs manually so at least you don't break the site for potentially dangerous requests.
Sti
Can do HTML all the time (Score:1)
Slashdot'ers talk, think, eat, and dream in HTML.
Some can even describe their dreams using VRML.
Re: (Score:1)