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

前端 未结 3 647
遇见更好的自我
遇见更好的自我 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:36

    the following should work

    var cfg=(System.Web.Configuration.CompilationSection) ConfigurationManager.GetSection("system.web/compilation");
    if (cfg.Debug)
    {
    ...
    }
    

提交回复
热议问题