ASP.NET/C# debug mode

Posted on 2004-11-04
Last Modified: 2010-05-18
Is there a way that I can tell programmatically if the application is running in debug mode as defined in the web.config file?


Question by:xmstr
    1 Comment
    LVL 6

    Accepted Solution

    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(){}


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


    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
    Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now