巧用Response.Write(message)中止异常
时间:2010-11-24 来源:dreamhappy
但是以上方法放在 try catch中会提示 错误 System.Threading.ThreadAbortException: 正在中止线程。为什么会报这样的异常,我还没有搞明白,为了在页面上抓错我们可以换一种方式解决问题
string error = string.Empty; 用于接收错误信息,判断是否有错误产生
bool sucess = false;
try
{
. .. ..
sucess = AddInfo();
}
catch (Exception ex)
{
Eagle.Common.Utils.WriteErrorToTXT(ex.ToString());
error = "添加信息失败";
}
finally
{
if (error.Length > 0)
ResponseInfo(error);
}
if (sucess)
ResponseInfo("sucess");
else
{
ResponseInfo("faile");
}
相关阅读 更多 +










