How do I check if Debug is enabled in web.config

前端 未结 3 618
遇见更好的自我
遇见更好的自我 2020-12-25 10:30

I have some code from my VB.NET 1.1 days that allowed me to dynamically check if Debug was enabled in web.config. I figured why re-invent the wheel in turning on/off logging

3条回答
  •  隐瞒了意图╮
    2020-12-25 10:56

    Use:

    HttpContext.Current.IsDebuggingEnabled
    

    This property actually looks at the web.config configuration setting. If you look at it using Reflector you will find that it gets the actual ConfigurationSection object using some internal classes.

提交回复
热议问题