断点aspx页面 [英] Break points aspx pages
问题描述
如何在 .aspx 页面中的服务器标记中设置断点.例如
How do you set a break points in server tags in .aspx pages. e.g.
<% dim breakhere =new object() %>
Web 应用程序正在调试模式下运行,web.config 中的 <compilation debug="true" ...
.但是页面说:
The web application is running in debug mode with the <compilation debug="true" ...
in the web.config. But the page says:
当前不会出现断点打.尚未加载任何符号这份文件.
The break point will not currently be hit. No symbols have been loaded for this document.
还有什么我需要设置的吗?
Is there anything else i need to set?
推荐答案
不是直接设置断点,而是使用
instead of setting the breakpoint directly, you could use
<% System.Diagnostics.Debugger.Break();
// more code here...
%>
也许更好的建议是不要将内联代码放入您的标记中 - 而是将其放入代码隐藏文件中的一个方法中,然后从您的标记中调用该方法.在代码隐藏的方法中,您可以像往常一样使用断点.
Maybe a better suggestion though is to not put inline code in your markup - instead put it in a method in the code-behind file, and then call that method from your markup. In your method in the code-behind, you can use the breakpoints as you normally would.
这篇关于断点aspx页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!