In an ASP.NET MVC program you can use
HttpContext.Current.IsDebuggingEnabled
In order to determine if debug="true"
in the web.config.
How do I do this without referring to the HttpContext?
You must read the configuration manually like this:
var compilation = (CompilationSection)ConfigurationManager.GetSection("system.web/compilation");
if (compilation.Debug)
{
//Debug is on!
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With