To check if debug="true" on web.config, check the following:
HttpContext.Current.IsDebuggingEnabled
Why should I care?
Take the example
try{
//a lot of code that makes something
}catch (Exception ex){
//Make the error handling of some sort, like log the error...
if(HttpContext.Current.IsDebuggingEnabled){
return ex.Message;
}else{
return "A error ocurred with the app, please retry again later or contact our it department";
}
}