Friday, January 2, 2009

Disable debug property in Web.config

While deploying an application in production server be sure to change the debug attribute to false in the compilation tag in Web.config. If it is set to true, it will be slowly eating more memory and the performance of the application will be compromised. Few controls like TreeView, Menu won't be cached if the debug is set to true and for this reason these controls will be downloaded for every request and some unnecessary debug codes will get executed there by slow down the application.

There may be chances to forget to change the property, and to avoid that, in 2.0 we can use machie.config file by adding the deployment tag. The syntax is shown below.

The default value is false and it is added only in machine.config and not in application level. After setting to true, it disables the output trace and turn off the detailed error message, so that hackers cant dig much into the internals of the application. This will ensure the application gives best performance and avoid security leaks.