option explicit

Discussion in 'ASP General' started by Mats, Sep 12, 2004.

  1. Mats

    Mats Guest

    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



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mats, Sep 12, 2004
    #1
    1. Advertising

  2. Mats wrote:
    > 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

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Sep 12, 2004
    #2
    1. Advertising

  3. Mats

    PW Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > 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 ?
     
    PW, Sep 12, 2004
    #3
  4. PW wrote:
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    >> 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 ?



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

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Sep 12, 2004
    #4
  5. Mats

    Mats Guest

    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

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mats, Sep 16, 2004
    #5
  6. Mats wrote:
    > 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.
     
    Dave Anderson, Sep 16, 2004
    #6
  7. Mats

    Mats Guest

    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



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Mats, Sep 17, 2004
    #7
  8. Mats wrote:
    > 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
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Sep 17, 2004
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric Mamet
    Replies:
    2
    Views:
    828
    William Ryan
    Oct 17, 2003
  2. J.T. Conklin
    Replies:
    1
    Views:
    449
    David Hilsee
    Aug 11, 2004
  3. Andy
    Replies:
    5
    Views:
    518
    Shezan Baig
    Jan 30, 2005
  4. Jerad Rose

    VB.NET ignoring Option Explicit setting

    Jerad Rose, Feb 27, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    573
    Juan T. Llibre
    Feb 27, 2007
  5. Replies:
    1
    Views:
    587
    Salt_Peter
    Dec 25, 2006
Loading...

Share This Page