如何确定是否编译调试="真"在web.config中 [英] How to determine if compilation debug="true" in web.config

查看:112
本文介绍了如何确定是否编译调试="真"在web.config中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里画一个空的东西,应该是简单...

我试图做这样的事情:

 <我:控制=服务器ID =身份识别码可见=<%=(编译是调试模式)%GT; />


解决方案

这应该让你的<编译> &LT元素;的System.Web> 节组:

 使用System.Web.Configuration;。 。 。CompilationSection compilationSection =(CompilationSection)System.Configuration.ConfigurationManager.GetSection(@的System.Web /编译);。 。 。//检查的&lt调试属性;编译>元件
布尔isDebugEnabled = compilationSection.Debug;

轻松!

I am drawing a blank here for something that should be simple...

I am trying to do something like:

    <my:control runat="server" id="myid" Visible="<%= (is compilation debug mode?) %>" />

解决方案

This should get you the <compilation> element in the <system.web> section group:

using System.Web.Configuration ;

. . .

CompilationSection compilationSection = (CompilationSection)System.Configuration.ConfigurationManager.GetSection(@"system.web/compilation") ;

. . .

// check the DEBUG attribute on the <compilation> element
bool isDebugEnabled = compilationSection.Debug ;

Easy!

这篇关于如何确定是否编译调试=&QUOT;真&QUOT;在web.config中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆