ASP.NET联编码基本问题 [英] ASP.NET Inline Coding Fundamental Questions
问题描述
我有困难的时候,我的调试任务。分配是由于作为一个单一的aspx页面。我的困难,我相信部分是由我的无能造成的,通过使用断点调试正常的视觉工作室我的aspx页面。
我的第一个问题:这是可以做到的。
?所有的资源,我发现网上说的解决方案是创建一个单独的类文件。
我去这样做,我只是想确保没有其他的方式去使用脚本块中的断点之前。
我的下一个问题涉及到一个内嵌脚本块的格式。我特别困惑涉及使用全局变量。既然是一个脚本标记,有什么不同,我需要知道的一样,当他们掉下来的范围是什么?如果我在脚本的全局范围内声明一个ArrayList和使用Add方法上按一下按钮,将其结果是相同的,类似的背后code的?
下面是一些简单的code来证明我的困惑:
<脚本=服务器> ArrayList的人=新的ArrayList(); 保护无效的button1_Click(对象发件人,EventArgs的发送)
{
al.Add(TextBox1.Text);
}< / SCRIPT>
这是一个已经被问了很多次的通病。见
<一个href=\"http://stackoverflow.com/questions/4945677/why-cant-i-debug-my-asp-net-web-project-anymore\">Why无法调试我的asp.net web项目了吗?
<一个href=\"http://stackoverflow.com/questions/2446756/why-am-i-unable-to-debug-my-asp-net-website-in-visual-studio\">Why我无法调试我的ASP.NET网站在Visual Studio?
Unfortuantely,因为它可以从许多来源产生,则pretty多有通过的可能出现的问题的分辨率栈工作。
I am having a difficult time debugging my assignment. The assignment is due as a single aspx page. My difficulty I believe is partially caused by my inability to properly debug my aspx page in Visual Studios by using breakpoints.
My first question: Is this possible to do?
All of the resources I discovered online have said the solution is to create a separate class file.
Before I go about doing that I just wanted to be sure that there is no other way to go about using breakpoints within a script block.
My next question pertains to the format of an inline script block. My particular confusion relates to the use of global variables. Since it is in a script tag, is there anything different I need to be aware of like when they fall out of scope? If I declare an ArrayList in the global scope of the script and use the Add method on button click, will the result be identical to that of similar code behind?
Here is some simple code to demonstrate my confusion:
<script runat="server">
ArrayList al = new ArrayList();
protected void Button1_Click(object sender, EventArgs e)
{
al.Add(TextBox1.Text);
}
</script>
This is a common problem that has been asked a number of times. See
Why can't I debug my asp.net web app
Why can't I debug my asp.net web project anymore?
Why am I unable to Debug my ASP.NET website in Visual Studio?
Unfortuantely, since it can arise from a number of sources, you pretty much have to work through the stack of possible problem resolutions.
这篇关于ASP.NET联编码基本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!