CodeGarden 10: The sixth annual Umbraco Developer Conference
June 23-25th 2010 - free ASP.NET MVC pre-conference. Register today!

Hide debugging features for production systems

Pages

As you may know, umbraco has a feature that allows you to see what is going on behind the scene in order to debug your templates: you can get the complete stack trace for a page by appending "?umbDebugShowTrace=true" to the page's url and you can get the list of elements (macro and fields ) that make up a page by appending "?umbDebug=true" to the page's url.

This feature cannot be turned off but, for production systems, you can easily block it by using the url rewriting feature included in umbraco 3.0:

just add

<add name="nodebug" 
virtualUrl="(.*)umbDebug.*"
rewriteUrlParameter="IncludeQueryStringForRewrite"
redirect="Application"
destinationUrl="~$1"
ignoreCase="true" />

in the <rewrites> section of your /config/UrlRewriting.config file and touch web.config to restart the web application.

This information was copied from this umbraco book and adjusted so it would work with systems that have "useDirectoryUrls" set to "true". The dependency on ".aspx" in the URL has therefore been removed.

Please refer to the original book if you explicilty want to depend on ".aspx" being in the URL's.

Debugging output can also be disabled using:

<add key="umbracoDebugMode" value="false" />