title: How do I check if Debug is enabled in web.config
body: <p>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 if I could simply have the web administrator enable debug.  Here is the code I used in VB.NET that worked just fine:</p>
  
  <pre><code>ConfigurationSettings.GetConfig("system.web/compilation").Debug.ToString()
  </code></pre>
  
  <p>When I wanted to convert this to C# and use it in .NET 3.5 I ran into some trouble and it wouldn't work.  Additionally, I would like to use the newer construct of ConfigurationManager.GetSection.  Can anyone suggest how best to read the <code>system.web/compilation/debug=true|false</code> value?</p>
  
  <p>Much appreciated!</p>