可遇不可求的Question之正在中止线程异常

Response.End,Response.Redirect等导致"正在中止线程"的问题
如果是Response.End(),可用HttpContext.Current.ApplicationInstance.CompleteRequest()来代替(据个人测试,貌似使用这句后,后边不能再有程序执行,否则仍然会继续执行下去?)
对于Response.Redirect()可用其重载方法:Response.Redirect(string,bool)
当然,Server.Execute(),Server.Transfer()情况也类似.

==============================================

关于 的解决方案见MS KB:

PRB: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer

http://support.microsoft.com/default.aspx?scid=kb;EN-US;312629

另,如果网站设置了自动超时,则超过超时时间也会爆出相应提示。

原文地址:https://www.cnblogs.com/tigerjacky/p/1754136.html