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 >} }
In the Web. config file, locate the compilation element. Debugging is enabled when the debug attribute in the compilation element is set to true. Change the debug attribute to false to disable debugging for that application.
To debug, you need to find out what's happening to the value of key objects and variables such as weekday . Add output expressions by inserting @weekday as shown in the two places indicated by comments in the code. These output expressions will display the values of the variable at that point in the code execution.
Check these:
HttpContext.IsDebuggingEnabled
or
HttpContext.Current.IsDebuggingEnabled
Reference: IsDebuggingEnabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With