How I can check debug mode in MVC cshtml page

Viewed 3366

How I can check debug mode in MVC cshtml page? this code not working in cshtml page.

@{
bool isRelease = false;
#if DEBUG
isRelease = false;
#else
isRelease = true;
#endif
} @{ if(isRelease) { < p > result1 < /p > } else { < p > result2 < /p >} }

application display "result 2" but it must display "result 1"

1 Answers

Check these:

HttpContext.IsDebuggingEnabled

or

HttpContext.Current.IsDebuggingEnabled

Reference: IsDebuggingEnabled

Related