In this week's episode of "Darren learns stuff the hard way", we talk about Active Server Pages. I'm not talking about ASP.NET here, just classic ASP.
One misconception some might hold is that (classic) ASP == BASIC. ASP is actually (kind of) language-neutral. All ASP is, is a mechanism to mix server-side code and HTML (kind of like PHP without the drama
), and some basic objects for request data, response generation, persistent variables, sessions, and other basic stuff. In addition to using VBScript, you can also use JScript (also provided by default), PerlScript (just install ActiveState Perl and leave the checkboxes checked), Python (install ActiveState Python), and possibly other languages.
The reason I even dealt with this in the first place is that I was required to use IIS for this one project. That was the only actual technical requirement. I had many options.
- I could use PHP, but I'm conducting a war on PHP.
- I could use ASP+BASIC, but as with PHP, I'd have to write a lot more lines of code, find a basic-mode for Emacs, and would have to sift through a lot of really bad examples of code when looking for techniques to do things. Remember, guys, the "B" stands for "Beginner's", just like it did in 1964. :)
- I could use basic Perl scripts containing a bunch of here-documents, but those suck when you have loops.
- I could have tried Mason+ISAPI, but the only solution I was able to find so far would involve using URLs like /application/index.plx/path/to/actual/ma
son/file.mthml and I didn't want someone else to have to deal with it incase I get hit by a bus and die or something.
- I could have tried Mason+CGI and been done, but I wanted to see if I could produce a less inefficient solution.
- I could use some other Perl templating solution but I'd have to invest time acclimating myself to it.
- I could use PerlScript+ASP.
I chose the last option there. ASP is simple enough.
The thing I realized midway into the project is that ASP does not natively provide support for file uploads. Or for multipart/form-data at all. This is the single biggest WTF I have ever witnessed. Were it not for this characteristic, ASP would be one of the few technologies from Microsoft that aren't fundamentally wrong, and would be a legitimate alternative to PHP. So what do I do?
- I could have used a pure-ASP solution. But they're all written in VBScript and it's impossible to use it from PerlScript.
- I could have used an ASP component. But they are all either buggy, or cost hundreds of dollars for a single-site license.
- Why didn't I realize this sooner? I could write just the form action script on the file uploads as a .plx script and use the CGI module for form data parsing.
That last option's what I'm doing. I don't get the benefit of ASP there but I think it's okay at least for now to either just die() with an error (the user will click the back button) or redirect to the next step on success.
Hopefully no more stumbling blocks. Wish me luck.