Tuesday, March 06, 2007

Lottery Websites

Ok, so like everyone else I bought some Mega Millions tickets today. Unfortunately, due to the crapiness of all of the lottery websites out there, I may never know if I won. The Megamillions site never even responds.

(Though the odds are about 144,999,999 to 145,000,000 that I did not win, so I think I'll get by without knowing for sure.)

Take the California lottery website. Please.

When it drew half a page of bad HTML, I noticed that they're using Viewstate for the winning results page. Viewstate! For a results page! For those of you who don't know what Viewstate is: it's one of the constructs put into ASP that no one understands that they should turn off. It keeps track of what the state of all the controls on a page. So someone clicks something, it encodes that state into a huge blob of text. Then when you click another control that gets you back to the same page, a form interprets and re-displays the controls the same way (e.g. you have this checkbox selected, this grid has row 3 selected, etc). This is great if you have five users. It's a bit of a problem if you have five million.

Tip for future people who need a tip: a lottery results page that's going to have 100m people hit it at exactly 11pm EST should be a static page, or pulled out of a cache as static data.

No comments: