Option Explicit - Statement Expected?

A

Agoston Bejo

I am generating WML pages from ASP.
I have header.inc that looks like this:

----------------------------------------------
<%@Language=VBScript%><%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/vnd.wap.wml;charset=UTF-8"
%>
[...]
----------------------------------------------

All ASP pages on the site start by including this file.
In index.asp it works, in another ASP it doesn't, and I get the "statement
expected" error.

I did some messing with the encoding of the files, I saved them in UTF-8
(65001)encoding in Visual Studio, then tried to save them again with Windows
Western European (1252) when I found out that this was neccessary. Can this
cause a problem in the server side script? I don't think so, but I cannot
imagine any other reasons why the same sequence of statements work in one
file and don't work in another.
 
M

McKirahan

Agoston Bejo said:
I am generating WML pages from ASP.
I have header.inc that looks like this:

----------------------------------------------
<%@Language=VBScript%><%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/vnd.wap.wml;charset=UTF-8"
%>
[...]
----------------------------------------------

All ASP pages on the site start by including this file.
In index.asp it works, in another ASP it doesn't, and I get the "statement
expected" error.

I did some messing with the encoding of the files, I saved them in UTF-8
(65001)encoding in Visual Studio, then tried to save them again with Windows
Western European (1252) when I found out that this was neccessary. Can this
cause a problem in the server side script? I don't think so, but I cannot
imagine any other reasons why the same sequence of statements work in one
file and don't work in another.

<!--#include file="header.inc"-->

1) Is the line above the first line in every ASP page?

2) Is the line above in the same folder as all ASP pages?
 
A

Agoston Bejo

See the answer below.

McKirahan said:
Agoston Bejo said:
I am generating WML pages from ASP.
I have header.inc that looks like this:

----------------------------------------------
<%@Language=VBScript%><%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/vnd.wap.wml;charset=UTF-8"
%>
[...]
----------------------------------------------

All ASP pages on the site start by including this file.
In index.asp it works, in another ASP it doesn't, and I get the "statement
expected" error.

I did some messing with the encoding of the files, I saved them in UTF-8
(65001)encoding in Visual Studio, then tried to save them again with Windows
Western European (1252) when I found out that this was neccessary. Can this
cause a problem in the server side script? I don't think so, but I cannot
imagine any other reasons why the same sequence of statements work in one
file and don't work in another.

<!--#include file="header.inc"-->

1) Is the line above the first line in every ASP page?
Yes.

2) Is the line above in the same folder as all ASP pages?

Yes.

Actually, I found something on the internet about this, and it says this
error may occur if you try to use undefined variables. (But as far as I
know, you'll get another error in that case, so it's kind of confusing.)
 
M

McKirahan

Agoston Bejo said:
See the answer below.

McKirahan said:
Agoston Bejo said:
I am generating WML pages from ASP.
I have header.inc that looks like this:

----------------------------------------------
<%@Language=VBScript%><%
Option Explicit
Response.Buffer = True
Response.ContentType = "text/vnd.wap.wml;charset=UTF-8"
%>
[...]
----------------------------------------------

All ASP pages on the site start by including this file.
In index.asp it works, in another ASP it doesn't, and I get the "statement
expected" error.

I did some messing with the encoding of the files, I saved them in UTF-8
(65001)encoding in Visual Studio, then tried to save them again with Windows
Western European (1252) when I found out that this was neccessary. Can this
cause a problem in the server side script? I don't think so, but I cannot
imagine any other reasons why the same sequence of statements work in one
file and don't work in another.

<!--#include file="header.inc"-->

1) Is the line above the first line in every ASP page?
Yes.

2) Is the line above in the same folder as all ASP pages?

Yes.

Actually, I found something on the internet about this, and it says this
error may occur if you try to use undefined variables. (But as far as I
know, you'll get another error in that case, so it's kind of confusing.)

What happens if you remove the following line?

Response.ContentType = "text/vnd.wap.wml;charset=UTF-8"

I'm not familiar with the MIME type "vnd.wap.wml".

Also, you don't need "Response.Buffer = True" with ASP 3.0 as it's the
default.
 
B

Bob Barrows [MVP]

Agoston said:
Actually, I found something on the internet about this, and it says
this error may occur if you try to use undefined variables. (But as
far as I know, you'll get another error in that case, so it's kind of
confusing.)
Yes, that error is possible if you refer to an undefined variable in such a
was as to make it look like a call to a statement. Without seeing the code,
we can't help you debug this.
 
G

Guest

Do the other pages have Option Explicit in them too? You can only have one,
include file or not.

If you're worried about the encoding, simply create a new file of the
correct encoding, paste the code, and delete the original.

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top