在ASP.net页面“System.Threading.ThreadAbortException”页面、net、ASP、ThreadAbortException

2023-09-05 00:53:25 作者:帅哥败在矮字

我有我的ASP.net页面的下方code:

I have the below code in my ASP.net page:

Response.StatusCode = 404
Response.Write(strResult)
Response.End()

在code以上抛出类型System.Threading.ThreadAbortException的异常发生,并且被抓住了。

The code above throws "An exception of type 'System.Threading.ThreadAbortException' occurred and was caught."

谁能告诉我为什么?而且我解决这个问题。

Can anyone tell me the reason why? And do I solve this.

感谢

推荐答案

调用到Response.End()从页面的任何子对象将最有可能导致系统.Threading.ThreadAbortException'例外。

Calling Response.End() from any child object of the page will most likely cause the 'System.Threading.ThreadAbortException' exception.

请阅读这个对于为什么这样一个完整的交代正在发生的事情和方法,以避免/处理异常。

Please read this for a full explaination of why this is happening and methods to avoid/deal with the exception.