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

推荐订阅源

博客园 - 叶小钗
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
雷峰网
雷峰网
WordPress大学
WordPress大学
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
V
Visual Studio Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 聂微东
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
U
Unit 42
W
WeLiveSecurity
博客园 - Franky
Recent Announcements
Recent Announcements
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
月光博客
月光博客
The Cloudflare Blog
Spread Privacy
Spread Privacy
腾讯CDC
P
Privacy International News Feed
N
News and Events Feed by Topic
AWS News Blog
AWS News Blog
NISL@THU
NISL@THU
T
Troy Hunt's Blog
小众软件
小众软件
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Microsoft Security Blog
Microsoft Security Blog
L
Lohrmann on Cybersecurity
Webroot Blog
Webroot Blog
Y
Y Combinator Blog
量子位
P
Palo Alto Networks Blog
N
News and Events Feed by Topic
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
IT之家
IT之家
T
Threat Research - Cisco Blogs
Cloudbric
Cloudbric
云风的 BLOG
云风的 BLOG
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
G
Google Developers Blog
S
Secure Thoughts

博客园 - Juniy

DedeCms 模板学习1 DIV盒子的CSS平面图 在asp.net页面中传递中文参数 - Juniy - 博客园 sqldatasource连接excel 2003 - Juniy - 博客园 SSI与SHTML学习 AjaxPro(ajax架构)在ASP.NET中的使用 常用命令备忘 .NET 实现ISAPI过滤器,指定类型文件防下载 将用户重定向到另一页的几种方法 贝塞尔样条 PetShop4 下载地址 ASCII 非打印控制字符表 (摘抄)什么是反射机制 (摘抄)禁止搜索引擎收录的方法(robots.txt文件的使用) (摘抄)DIV布局和网页设计 ASP.NET(C#)文件读写函数 C#中using的使用 修改url前图标(网上查到) JavaScript小技巧一
ASP.NET"正在中止线程"错误原因
Juniy · 2006-11-23 · via 博客园 - Juniy

以下内容摘自微软官网:



PRB:在使用 Response.End、Response.Redirect 或 Server.Transfer 时出现 ThreadAbortException

症状

如果使用 Response.EndResponse.RedirectServer.Transfer 方法,将出现 ThreadAbortException 异常。您可以使用 try-catch 语句捕获此异常。

原因

Response.End 方法终止页的执行,并将此执行切换到应用程序的事件管线中的 Application_EndRequest 事件。不执行 Response.End 后面的代码行。

此问题出现在 Response.RedirectServer.Transfer 方法中,因为这两种方法均在内部调用 Response.End

解决方案

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

对于 Response.End,调用 HttpContext.Current.ApplicationInstance.CompleteRequest 方法而不是 Response.End 以跳过 Application_EndRequest 事件的代码执行。
对于 Response.Redirect,请使用重载 Response.Redirect(String url, bool endResponse),该重载对 endResponse 参数传递 false 以取消对 Response.End 的内部调用。例如:
  Response.Redirect ("nextpage.aspx", false);
            
如果使用此替代方法,将执行 Response.Redirect 后面的代码。
对于 Server.Transfer,请改用 Server.Execute 方法。

posted @ 2006-11-23 08:34  Juniy  阅读(645)  评论()    收藏  举报