(ASP) Error using Option Explicit?! huh?

I am getting this error any time I try and put Option explicit at the top of my ASP page…


Microsoft VBScript compilation error '800a0400'

Expected statement

/mailform.asp, line 1

Option Explicit
^

Would anyone know why that is?

Are there any variables you are not initializing?

hmm…
not sure. i suppose there could be heh

is that the error I would get if that were the case?
seems like an off the wall sort of error response :frowning:

Im sure that must be the problem though

If you had an undeclared variable I’d normally expect an ‘Undefined variable’ error. Have you got any script before the Option Explicit statement? Remember, that if you ssi any files in the page that contain script then these include statements also have to come after the Option Explicit statement.

One other thing, if you’re using the script language directive this has to be contained within script delimiters even if more script follows straight after.

eg:
<%@ Language = “VBScript” %>
<% Option Explicit
'Rest of script …

yea its weird… i make sure to put Option Explicit FIRST THING on my page (cause Im not declaring the scripting language).

Another thing is… when I try and declare the scripting language… I get a 500 error

i dunno… weird stuff… and my books dont cover these things :frowning:

You should declare the scripting language as VBScript first, then use Option Explicit. Also, make SURE those are the first two lines in any ASP page.

Hope this helps. :smiley: