先重现问题浏览器
一、新建一个aspx页面项目,插入两个页面WebForm1.aspx,WebForm2.aspx,spa
WebForm1代码修改以下线程
protected void Page_Load(object sender, EventArgs e) { try { Response.Redirect("WebForm2.aspx"); } catch (Exception exception) { Console.WriteLine(exception); throw; } }
二、在浏览器中打开WebForm1.aspx,页面正常跳转到了WebForm2.aspx,可是若是在如下代码加上断点的话,会有Thread was being aborted异常抛出3d
三、问题缘由
response.redirect();日志
response.write();code
response.end();orm
会致使当前进程Abort,线程停止,Abort致使异常,虽然这个问题对实际代码运行没有影响,可是若是使用日志系统的话,会致使日志文件中有大量的Error错误。blog
四、解决办法
修改代码以下进程
或者it