#if DEBUG //blah blah #end ifSolution:
Switch to using something like this:
public static bool IsDevelopment
{
get
{
return HttpContext.Current.IsDebuggingEnabled;
}
}
This method uses the web.config defined attribute instead (configuration/system.web/compilation[debug="true"] attribute).