05
2008
An old project in a new light
Posted under Blog Posts, Software Design
So, I’m dusting off the source code for the ol’ www.myBabyNameGame.com site. I needed a practical sample for trying out some LINQ, AJAX, and maybe some MVC (but I’m not interested in re-plumbing the whole site with MVC at the moment).
This site is old and dank. I have not touched the source code in any significant manner for 5 years (since July 2003). Much of the code is lame-o-lamity-lame.
It has some neat features: PayPal PayFlow, a bitmap banner generator, an e-mail notification engine with one-click entry/auth URLs, and some flexible game options. It does not, however, have any practical object-oriented design, nor proper CSS, nor an attractive look-and-feel. It also has some hinky quirks that only I can see, but those quirks leave me feeling ashamed. This old bag of bits seemed like the perfect candidate for tinkering.
SO while I was wiring up the MyBabyNameGame projects on my Vista laptop, I stumbled into a couple of gotchas/differences between IIS 5 (in Windows Server 2003) and IIS 7 (on Vista Ultimate):
“Request” is not available in this context.
I fired up my web app and the very first error our of the chute was:
Server Error in ‘/’ Application.
Request is not available in this context
Luckily for me, this ground had been covered a long time ago:
This error is due to a design change in the IIS7 Integrated pipeline that makes the request context unavailable in Application_Start event.
A common example of this is using the HttpContext.Current.Request.ApplicationPath to get to the application’s root virtual path. This should become HttpRuntime.AppDomainAppVirtualPath. Voila, no need to use the request!
Sure enough. Thanks, Mike!
Forms Authentication and cookies:
My authentication technique is straight-forward. I use the web.config file in certain subfolders to deny all anonymous users and allow all authenticated users, and then authenticate users (passing the username/password challenge) with this code:
FormsAuthentication.RedirectFromLoginPage(“*”, false);
But, when I logged into the game and tried to view the management pages in those protected subfolders, the darn thing kept kicking me back out to the default login form (and also gave me some cryptic MSJscript errors regarding “Out of Memory” and “Stack Overflow at Line 0″
Through some intuition and some trial and error, I found that the “Cookie Settings” mode for the web was set to “Use Device Profile.” I set it to “Use Cookies,” and that seemed to do the trick. It stopped continuously sending me back to the login page even after I had logged in and authenticated.
Was this endless loop a result of a setting in the web.config, or using AUDAUTH instead of ASPXAUTH, or what? I know, I know… cookies are so old school and they present a variety of obstacles. Listen, that’s what I had to work with in 2003. I might change the site’s state management scheme in the future.
Onward
So, I am on my way, AJAX’ing and LINQ’ing portions of this ugly old hag, and I might even take a moment to give it a facelift.


Add A Comment