Reputation: 23945
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?
Upvotes: 4
Views: 2017
Reputation: 119116
You must read the configuration manually like this:
var compilation = (CompilationSection)ConfigurationManager.GetSection("system.web/compilation");
if (compilation.Debug)
{
//Debug is on!
}
Upvotes: 8