2011-03-13 24 views
0

腳本到Response.End()發送在MasterPage_pagrLoad錯誤

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

代碼 ()

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()錯誤說:無法因爲代碼被優化,以計算表達式或原生框架位於調用堆棧頂部 爲什麼?

+0

[asp.net中下載文件時出現異常]的可能重複(http://stackoverflow.com/questions/5291180/exception-when-download-file-in-asp-net) – 2011-03-13 19:31:38

回答

0

Response.End使用ThreadAbortException結束頁面的執行並將緩衝區刷新到客戶端(MSDN)。 Response.Flush()不會生成ThreadAbortException。