[thelist] 1st line of ASP Scripts (option explicit/on error/transaction)

Wade Armstrong wade_lists at runstrong.com
Fri Jul 26 18:30:01 CDT 2002


on 7/26/02 2:40 PM, Michael K. Ahn at mike at ahnfire.com wrote:

> Hey, it seems like everything is supposed to be on the 1st line of an
> asp script.  Does anyone know the definitive order?
>
> Ie.
> Transaction=Required
> Option Explicit
> On Error Resume Next
> Response.ContentType = "video/x-ms-asf"
> Response.expires = 0
>
> Dim x
> Etc
>
> Facts?  Opinions?

Well, as for facts:
Option Explicit is a compile-time instruction, so it must come first. Try
not putting it first, you'll get an exception.

All the rest should come when it makes sense in your code. Don't set headers
until you're ready to set headers. Dim your variables in some logical manner
(for long scripts, I like to dim everything at the top so I don't reuse
variable names).

Wade




More information about the thelist mailing list