Exploring ASP.NET & Web Development
Classic ASP in the New Millennium
By Don Kiely
I have the perfect client. The company is full of fun, interesting people who bubble over with interesting ideas about their business and life. They are local to me, which is a treat living in the small town of Fairbanks, Alaska doesn t exactly put me in any technical hotbed of the world (although, with the main campus of the University of Alaska here, we have a strong technical community; the heavy metal, supercomputer kind).
The company runs a highly regarded content-based website that is not cheap for subscribers, and people flock to sign up. Best of all, they listen to me. They don t always follow my advice, but they carefully consider it and usually have very good reasons for not doing what I suggest.
Well, okay, they do have one nearly fatal flaw. Here it is 2009, and their website is built with classic ASP (sometimes referred to as moldy or archaic ASP), not that cool technology that ends in .NET that we all love. How last millennium! Frankly, I can t believe that I m still writing and maintaining VBScript code, when the .NET languages, including the new dynamic languages, beckon. I do new stuff for them using .NET where I can, and I have put together some nifty AJAX stuff they love. And, we re laying the foundation for a move to a content management system that will make their lives far easier and that will let them extend their services to subscribers (a compelling reason for them to migrate to .NET). In the meantime, the site is good ol ASP.
When I first started working with this company I was concerned that Microsoft would stop supporting ASP, now that ASP.NET has been in the wild for years now. But I happily discovered that because it is a part of Windows and doesn t seem to be going away any time soon it remains fully supported, with no sunset (that I know of). Besides, a surprisingly huge part of the web is still running on ASP, so I guess Microsoft has no choice but to continue offering it in new versions of Windows. Oh well, I guess I can t use that as an argument to move more quickly to ASP.NET!
Other than working with old technologies, running ASP really hasn t been much of a problem until recently, when we had to cut loose our old hosting company, where the site was running on a dedicated host on Windows Server 2003. Off we went to another hosting company that already provided a server for another of my client s member services, with a brand new Windows Server 2008 dedicated server. At the very least, we d be running on the latest and greatest, far more secure version of Windows!
For the most part, the planning and transition to the new server went well and was relatively painless. The metabase for IIS is completely different in 2008 than earlier versions, so we had to carefully configure the various virtual web servers we needed. Setting up and configuring SQL Server 2008 was painless, too; those migration issues are well understood and the website doesn t make use of any exotic or esoteric database features.
But there were problems, of course, with which we had to deal. One is that a few small portions of the site use some VB6 DLLs that I m pretty sure were written by someone for whom this was their first learning project in VB6, server DLLs, and maybe even programming. Simply put, they are a mess. But the problem is that the source code my client thought they had for the DLLs was not the right source code. And, of course, the DLLs implement some gnarly logic not easily replaced. It would be a huge project to replace them with good code. Worse yet, the people who wrote the code are long gone.
I did everything I could to compile the VB6 code into drop-in replacements for the existing DLLs when I started working for this client years ago, but was never successful. So we ve lived with what we started calling the evil DLLs, even to the point of making some minor changes to them using a binary editor (and, of course, gradually reducing where they are used in the website). These DLLs worked okay on Windows Server 2003, and NT before that, but started balking on the new server in seemingly random ways.
We ran into other problems, as well, but most issues simply required digging deeply into IIS 7 s configuration setting to tune the site. One interesting problem is that, by default, ASP no longer displays server scripting error messages to the client. This is a good change both for client experience and security, but can make it difficult to debug problems. So you either must temporarily turn on server debugging and run the debugger in a remote desktop session which by default is the Visual Studio debugger or change the setting to again display scripting errors in the browser. You ll find both these settings in IIS Manager in the ASP configuration applet under Debugging Properties: Enable Server-Side Debugging and Send Errors to Browser. Both are false by default. And, of course, we ll be improving global error handling!
I was happy to find that there are plenty of resources for moving ASP applications to Windows Server 2008 and getting them to run happily there. The best by far is the IIS7 - Classic ASP forum on the www.iis.net forums. I was able to prepare for and prevent most of the worst problems when we moved, simply by trolling through all the questions that have been asked there over the last couple of years. Another great resource is Bill Staple s blog Microsoft s General Manager of the Web Platform and Tools engineering teams at http://blogs.iis.net/bills. He has a couple of ASP blog entries (click ASP in the tag cloud) that provide solutions to the most common problems with ASP on IIS7.
So, painful as it can be at times, ASP remains a viable platform for websites nearly a decade into this new millennium. There may be many compelling reasons to move to more contemporary web technologies (think Web 2.0, although you can certainly implement some features using ASP), but Microsoft is not forcing the world to abandon ASP. Yet. ASP is certainly not moving forward; in fact it is stagnating. Nevertheless, ASP websites will probably keep running for many years to come.
Don Kiely, MVP, MCSD, is a senior technology consultant, building custom applications as well as providing business and technology consulting services. His development work involves tools such as SQL Server, Visual Basic, C#, ASP.NET, and Microsoft Office. He writes regularly for several trade journals, and trains developers in database and .NET technologies. You can reach Don at mailto:[email protected] and read his blog at http://www.sqljunkies.com/weblog/donkiely/.