Razor中判断是Debug模式还是Release模式

Razor视图文件中判断是Debug模式还是Release模式

@if (!HttpContext.Current.IsDebuggingEnabled)
{
}

HttpContext.Current.IsDebuggingEnabled的值取决于web.config中的

<compilation debug="true" targetFramework =" 4.5" />