Make sure you disable debugging in production!
Nicolas Galler | December 2, 2009Here is a quickie… Several times I have made the mistake of shipping a web.config with debugging enabled (fortunately always caught it at the last minute so far). This has a horrible affect on performance because it prevents caching. It can also cause some serious memory issues under heavy load. So I made myself a big warning on the login page:

The code for it looks like this (in Login.aspx):
</asp:Login>
<asp:Label style="clear: both; display: block; width: 100%; text-align: center; color: red; font-size: 24pt" runat="server" id="lblDebugWarning"
Text="Debugging Enabled in web.config - Set to False for Production" />
</asp:Content>
And under Page_Load, very simple:
protected void Page_Load(object sender, EventArgs e)
{
lblDebugWarning.Visible = HttpContext.Current.IsDebuggingEnabled;
System.Web.UI.WebControls.CheckBox rememberMe = (System.Web.UI.WebControls.CheckBox)slxLogin.Controls[0].FindControl("chkRememberMe");
By the way it slightly funks up the display for IE6 – but only when the label is actually displayed, so not a big deal.





