ASP.NET前端.aspx頁面(部署時隱藏代碼)。使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>
的問題是當項目被推入live測試環境,他們仍然看到按鈕!它開始爲:display:none;
,並且不知何故,這個代碼即使在部署時也會被擊中!
SOLUTION ::感謝@Icarus測試 web.config中的環境也有
<compilation debug="true">
因爲這對我們發展的環境中只能工作我必須做的事情:
<% If (System.Configuration.ConfigurationManager.AppSettings("Environment").ToUpper() = " DEVELOPMENT") Then %>
// stuff here
<% End if %>
我看不到任何生成「#fillForm」按鈕的代碼 – outcoldman