When an ASP.NET System.Web.HttpResponse.End() is called, the current thread is aborted?

前端 未结 5 483
你的背包
你的背包 2020-12-31 03:56

when a System.Web.HttpResponse.End() is called a System.Thread.Abort is being fired, which i\'m guessing is (or fires) an exception? I\'ve got some logging and this is being

5条回答
  •  感情败类
    2020-12-31 04:21

    There is no such thing as a "graceful" abort. You could simply Flush() the response, though, instead of ending it and let the framework take care of closing the connection for you. I'm assuming in this case that you want the response sent to the client, i.e., the typical case.

    According to MSDN, calling Response.End() throws the ThreadAbortException when the response ends prematurely. You really should only call Response.End() when you want the exception raised.

提交回复
热议问题