• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 487
  • Last Modified:

ASP.NET/C# debug mode

Is there a way that I can tell programmatically if the application is running in debug mode as defined in the web.config file?

   <compilation
         defaultLanguage="c#"
         debug="true"
    />

0
xmstr
Asked:
xmstr
1 Solution
 
dharmesh_amityCommented:
There is a DEBUG flag.

You can use preprocessor directive as
#if DEBUG
...

OR Use conditional compilation by adding attribute
[Conditional ( "DEBUG" )]
public void hello(){}


Or

Debug.WriteIf(debug.Enabled, "Some debugging ouput");

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now