惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
GbyAI
GbyAI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Y
Y Combinator Blog
Recorded Future
Recorded Future
博客园 - Franky
I
InfoQ
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
T
Tailwind CSS Blog
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
雷峰网
雷峰网
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MongoDB | Blog
MongoDB | Blog
F
Full Disclosure
Google DeepMind News
Google DeepMind News
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Check Point Blog
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
U
Unit 42
N
Netflix TechBlog - Medium
The Cloudflare Blog
Spread Privacy
Spread Privacy
Microsoft Azure Blog
Microsoft Azure Blog
美团技术团队
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tenable Blog
B
Blog
S
Securelist
H
Hacker News: Front Page
Google Online Security Blog
Google Online Security Blog
G
Google Developers Blog

博客园 - 笨笨丁

IIS启用兼容模式设置(win2k3—Win7) C#调用java类、jar包方法(转) 解决VML遭遇IE8和XHTML DOCTYPE时不能运行的问题(转) Nice Validator(Form验证)及Juery zTree控件 SQL语句Where中使用别名作为判断条件 50个令人惊奇的jQuery插件(对话框和表单篇)及免费的响应式bootstrap管理员后台界面主题 - Charisma PowerDesigner设计时表显示注释选项 showModalDialog 的重要提示 在网页中怎样给已发布的Flash添加链接的方法(zhuan) ASP.NET网站中获取当前虚拟目录的应用程序目录的方法(转) __doPostBack()没有定义解决方法(转) jQuery插件实战之fullcalendar(日历插件) - 使用fullcalendar开发一个功能完整的富客户端会议室预定系统(转) ajaxpro返回值类型总结-DataTable(转) Ibatis.net总是报:【ExecuteStoreCommand SqlParameterCollection 中已包含 SqlParameter】(转) jQuery校验validate详解(转) 一个.NET通用JSON解析/构建类的实现(c#)转 C# JSON字符串序列化与反序列化(转) AjaxPro新发现-错误处理 SVN专题:SVN Client API的.net 接口 SharpSvn介紹 Checkout操作实例,SVN权限(转)
ASP.NET程序中 抛出"Thread was being aborted. "异常(转)
笨笨丁 · 2013-10-17 · via 博客园 - 笨笨丁

Thread was being aborted :中文意思 线程被终止

引用地址:http://support.microsoft.com/default.aspx/kb/312629/EN-US/?p=1

原因:

那个 Response.End 方法结束页的执行,并转移到执行 的Application_EndRequest 事件在应用程序的事件管道。该行的代码如下 Response.End 不会被执行。
此问题出现在 Response.RedirectServer.Transfer方法 方法,因为这两种方法调用 Response.End 在内部。

解决方案:

若要解决此问题,请使用下列方法之一:

  • 为了 Response.End,调用 HttpContext.Current.ApplicationInstance.CompleteRequest 方法,而不是 Response.End 绕过的代码执行 的Application_EndRequest 事件。

try{

HttpContext.Current.Response.ContentEncoding = utf;
           HttpContext.Current.Response.Write(style);
           HttpContext.Current.Response.Write(sb.ToString());
           //HttpContext.Current.Response.End();

}
catch{}
finally
{
System.Web.HttpContext.Current.ApplicationInstance.CompleteRequest();
}

  • 为了 Response.Redirect,使用过载, Response.Redirect(string URL,bool endResponse) 的推移 false endResponse 参数压制内部电话 Response.End。例如:
      Response.Redirect(“nextpage.aspx”,false);
    						

    如果您使用此解决方案,下面的代码 Response.Redirect 被执行。

  • 为了 Server.Transfer方法,使用 使用Server.Execute 方法来代替。

另:尽量不要把Response.Redirect("targetUrl");语句写在try里面了! 使用Response.Redirect("targetUrl",false);