ASP.NET前端.aspx页面(部署时隐藏代码)。
我只想为我们开发人员提供一个按钮,自动填充这个巨大的表单,我唯一能找到的就是:
<script>
$(function () {
<% If (Context.IsDebuggingEnabled) Then %>
$('#fillForm').show().on('click', function () {
// nothing special here, loops through items and fills them in
});
<% End If %>
// other normal JS code here
});
</script>问题是,当项目被推入实时测试环境时,他们仍然会看到按钮!它的开头是:display:none;,而且这段代码甚至在部署时也会被击中!
解决方案::感谢@Icarus测试环境web.config还有
<compilation debug="true">
为了使它只在我们的开发环境中工作,我不得不这样做:
<% If (System.Configuration.ConfigurationManager.AppSettings("Environment").ToUpper() = " DEVELOPMENT") Then %>
// stuff here
<% End if %>发布于 2012-08-22 14:39:55
这意味着生产中的Web.config在编译部分仍然有debug=true。在部署到生产中时,应该始终将标志设置为false。这会影响性能,而且可能会暴露更多关于异常的细节,而不是用户所能看到的。
发布于 2012-08-22 14:28:33
根据您的状态,在您的实时测试环境中,Context.IsDebuggingEnabled必须是真的。
https://stackoverflow.com/questions/12075290
复制相似问题