In any (non-web) .net project, the compiler automatically declares the DEBUG and TRACE constants, so I can use conditional compiling to, for example, handle exceptions differently in debug vs release mode.
For example:
#if DEBUG
/* re-throw the exception... */
#else
/* write something in the event log... */
#endif
How do I obtain the same behavior in an ASP.net project? It looks like the system.web/compilation section in the web.config could be what I need, but how do I check it programmatically? Or am I better off declaring a DEBUG constant myself and comment it out in release builds?
EDIT: I'm on VS 2008