简体   繁体   中英

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, eg connection strings. Is there anything like this available in classic ASP?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM