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

作者: 吴杰 分类: 编程 发布时间: 2015-06-13 11:36

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

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

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

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