option explicit

M

Mats

Option Explicit does not work anymore.(?)
If you put <%option explicit%> at the top of your pages (direktly after
the language declaration) you should get an error for each undeclared
variable. This does not happen, but undeclare variables lead to some odd
results.

Error somewhere or has IIS changfed its behavior?
"Testbed" Win XP Pro SP2
 
B

Bob Barrows [MVP]

Mats said:
Option Explicit does not work anymore.(?)
If you put <%option explicit%> at the top of your pages (direktly
after the language declaration) you should get an error for each
undeclared variable. This does not happen, but undeclare variables
lead to some odd results.

Error somewhere or has IIS changfed its behavior?
"Testbed" Win XP Pro SP2

<%option explicit%> affects only server-side code. The brwoser used to test
this should not matter.

If you want option explicit in client-side vbscript (which is not
recommended), then you have to make it the first line executed in your
client-side script.

Bob Barrows
 
P

PW

Bob Barrows said:
If you want option explicit in client-side vbscript (which is not
recommended), then you have to make it the first line executed in your
client-side script.



Why is option explicit in client-side vbscript not recommended ?
 
B

Bob Barrows [MVP]

PW said:
Why is option explicit in client-side vbscript not recommended ?


I meant that vbscript code in client-side script is not recommended,
especially if you want cross-browser functionality.

Bob Barrows
 
M

Mats

Hi
Thanks for reply - been to busy to check until now.
No, it's not client side, it is in my testbed IIS on Win XP pro SP2
I use it to see the result before uploading to the server


Mats
 
D

Dave Anderson

Mats said:
Hi
Thanks for reply - been to busy to check until now.
No, it's not client side, it is in my testbed IIS on Win XP pro SP2
I use it to see the result before uploading to the server

Context, please.



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 
M

Mats

In any asp page where I try to use Option Explicit
there is no error message for undimmed variables, the page just does not
execute. Other errors produce an error page in the normal way (just
tested)
Pages begins
<%@ Language=VBScript %>
<%option explicit%>
<%'more code and html....%>
It used to produce an error for undimmed variables and it should...
It also happens when I test a page (with an undimmed variable) on the
server for our homepage (IIS 6.0) not just on my "testbed" (IIS 5.1)
Any patch that might change the behavior of IIS?
It seems that not just my pc is affected.
Mats
 
B

Bob Barrows [MVP]

Mats said:
In any asp page where I try to use Option Explicit
there is no error message for undimmed variables, the page just does
not execute. Other errors produce an error page in the normal way
(just tested)
Pages begins
<%@ Language=VBScript %>
<%option explicit%>
<%'more code and html....%>
It used to produce an error for undimmed variables and it should...
It also happens when I test a page (with an undimmed variable) on the
server for our homepage (IIS 6.0) not just on my "testbed" (IIS 5.1)
Any patch that might change the behavior of IIS?
It seems that not just my pc is affected.
Mats

This really doesn't help. For all we know, there could be something in

<%'more code and html....%>

that is causing this behavior. You should produce a real 3 or 4 line page
that exhibits the behavior so we can attempt to reproduce it. Here's my
attempt:

<%@ Language=VBScript %>
<%option explicit%>
<%
s = "testing"
response.write "s contains """ & s & """"
%>

Are you saying that when you copy this into a page and run it that you get
neither an error message nor a result from the response.write? I'm running
IIS6 on XP Pro SP2 and I get the expected error when I run this page. I
tried it on my company's servers and still received the expected error.

Does your web server have a custom error page? Is it configured to not send
error messages to the client?

Bob Barrows
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top