Previous Next

Thread: option explicit on by default?

Last post 06-30-2008 6:44 AM by steve schofield. 8 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (9 items)

Sort Posts:

  • 04-28-2008, 5:29 AM

    option explicit on by default?

    Question,

    In IIS7 (on Win2008), is option explicit on by default? I'm looking at some code (of course not mine!!! ;-) and it throws all kinds of errors on IIS7 because they don't declare their variables but just start using them.

    When I throw in a "dim" everything works.

    Can I turn it off? It's in like 1000s of files.

  • 04-28-2008, 11:01 AM In reply to

    • rlucero
    • Top 50 Contributor
    • Joined on 09-29-2006, 3:35 PM
    • Seattle, WA
    • Posts 121

    Re: option explicit on by default?

    Drop this into your sites' config files or set this in the machine's root web.config file.  The specific section for this is system.web/compilation. 

    <system.web>
         <compilation explicit="false" />
    </system.web>

    Using Administration Pack's Configuration editor will make changing this easy. 

  • 04-29-2008, 4:49 AM In reply to

    Re: option explicit on by default?

    As far as I know that's for VB.NET and not for classic asp vb stuff. I still get the following error:

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'image_type'

  • 04-29-2008, 9:37 AM In reply to

    Re: option explicit on by default?

    Anyone?

  • 04-29-2008, 11:12 AM In reply to

    • rlucero
    • Top 50 Contributor
    • Joined on 09-29-2006, 3:35 PM
    • Seattle, WA
    • Posts 121

    Re: option explicit on by default?

    Have you checked the asp pages' code to see if option explicit is set?

  • 04-29-2008, 1:27 PM In reply to

    Re: option explicit on by default?

    Yes, it's not on. That's why it's not working in IIS7 as it seems, although it did work in IIS6 on Windows2003.

    But there are like 10.000s of pages and we can't all just check them to see if they work. Especially because the error only occurs when you're passing through the code. If the code isn't hit, the error doesn't occur.

  • 05-05-2008, 8:01 AM In reply to

    Re: option explicit on by default?

    Anyone? Pretty please?

  • 06-27-2008, 3:09 AM In reply to

    Re: option explicit on by default?

    I think Option Explicit On

    have a look at Option Explicit

     

    http://vb.net-informations.com/language/vb.net_option_explicit.htm

     

    belman

     

  • 06-30-2008, 6:44 AM In reply to

    Re: option explicit on by default?

    Option Explicit is not on by default.  I wrote a simple webpage to write out the date and time and it worked fine.   You probably have an include file or somewhere in-code setting Option Explicit.  I would search inside files with Windows Search feature to see if you can find the text.

    <%
    var = Now()
    response.write(var)
    %>

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield

    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
Page 1 of 1 (9 items)
Page view counter