By default, ASP.NET's web.config turns on debugging for your AVR, Wings, Mobile RPG, and Monarch Web applications. It does so with the debug attribute in web.config's compilation element, as shown below:

    <compilation debug="true">

During development, having debugging enabled is great. Without it, you can't use Visual Studio's source-level debugger.

However, for production purposes, leaving debug enabled is a Very Bad Thing!. Debug impedes production performance--perhaps most notably by disabling resourcing caching. It also causes error message detail to be displayed that may be helpful to bad dudes on the Internet looking to make your day miserable.

If you publish your Web sites with Visual Studio's "Build->Publish Web site" option, debugging is probably disabled during that deployment process. However, if you've edited your Web project's web.debug.config you may have disabled this feature. To ensure this feature is working during the "Build->Publish Web site" process, make sure there is a web.debug.config file in your project and confirm it has this line it:

compilation xdt:Transform="RemoveAttributes(debug)" />

This line causes ASP.NET web.config transformations to remove the debug="true" from web.config during deployment.

But you aren't doing that, are you?

So, the good news that if you are deploying your ASP.NET applications properly, debug mode gets disabled automatically for you. However, I am sure that many of you are taking the lazy way out and simply manually (with maybe a little help with a batch file or two) copying files from your development folder to your deployment folder. If you're doing deployment this way it's almost a sure bet that you're deploying your AVR/Wings/MR/Monarch with debug mode enabled. If you're doing it this way, remember to always manually change web.config's debug attribute to false (or just remove that attribute).

Build in a little warning

Because this is such a bad thing to do, consider building a little warning into your ASP.NET applications. Adding this code immediately under the <body> tag in your app's master pages:

If (HttpContext.Current.IsDebuggingEnabled)     
    <small style="padding:6px; color: #721c24; background-color:#f8d7da; 
           border-color: #f5c6cb;">
           Debugging is enabled

displays this pink warning message in the upper left-hand corner of every page in your Web app.


Figure 1. A reminder that your Web app is running under debug mode

With this little reminder in place, you are always sure if an application is deployed with debug enabled.