This one is specifically to your question about determining debug from web.config:
var configSection = ConfigurationManager.GetSection("system.web/compilation");
if (configSection.Debug) {
// your code
}
I think you would also need to cast that appropriately. Just off the hand.
Yup. You got to cast it to System.Web.Configuration.CompilationSection
.