Search code examples
c#vbscriptasp-classicjscript

Does classic ASP have an equivalent to the #if DEBUG statement from C#?


In C#, I can say

#if DEBUG
    Console.WriteLine("we are in debug mode");
#else
    Console.WriteLine("we are in release mode");
#endif

This is handy for managing things that need to be different between debug and release builds, e.g. connection strings. Is there anything like this available in classic ASP?


Solution

  • The short answer is: No.

    But that doesn't mean you can't build your own debug flag then use that. There are various ways to do this using Application or Session variables.

    You could then use them something like;

    'Application variable should have been set in the global.asa file.
    Dim debug: debug = (Application("debug") = True)
    If debug Then
      'Output some debug information.
    Else
      'Release mode.
    End If
    

    Useful Links