response.end()发送错误

时间:2011-03-13 19:28:22

标签: asp.net xml jquery

脚本

$.ajax({
type: "post",
url: "Index.aspx?cmd=SettingCreateMember",
success: parseXml
});

代码 在MasterPage_pagrLoad()

if (Request["cmd"] == "SettingCreateMember")
        {
            var doc = XDocument.Load(Server.MapPath(".") + "\\Administrator\\Questions.config");
            Response.Write(doc);
            Response.End();  //this line error:Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
}

内联response.end()错误说:无法计算表达式,因为代码已优化或本机框位于调用堆栈之上 为什么呢?

1 个答案:

答案 0 :(得分:0)

Response.End使用ThreadAbortException结束页面执行并将缓冲区刷新到客户端(MSDN)。 Response.Flush()不会生成ThreadAbortException。