asp.net mvc - #if DEBUG returns true on production server -


we have following code on global.asax of mvc web application

    protected void application_beginrequest()     {         #if debug         if (!string.isnullorempty(httpcontext.current.request["debug"]))         {             routedebug.routedebugger.rewriteroutesfortesting(routetable.routes);         }                         #endif     } 

the "compilation debug" atribute set "false" in web.config of production server. expected behavior above code never executed . works of time, of sudden app starting execute code. continue until iis reset. can't seem figure out why of sudden our website goes debug mode automatically. idea?

the #if debug line compiler directive , can called if debug constant has been defined manually in code or specified in build (which set in project properties.

the web.config compilation value of debug="true" different thing. determine if has been set, can use instead:

var compilation = (compilationsection)configurationmanager                       .getsection("system.web/compilation");  if (compilation.debug) {     //debug on! } 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -