我们可以使用Response.Flush()而不是到Response.End() [英] Can we use Response.Flush () instead of Response.End()
问题描述
到Response.End()
生成 ThreadAbortException
。
代替它使用 HttpContext.Current.ApplicationInstance.CompleteRequest
不解决问题。
Using HttpContext.Current.ApplicationInstance.CompleteRequest
in place of it doesn't solve the problem.
那么,能不能我们使用 Response.Flush()
而不是到Response.End()
So, can we use Response.Flush()
instead of Response.End()
推荐答案
的 Response.Flush()
是发送到浏览器什么的缓冲,但不会停止页的处理,因此它会继续的下一个步骤的执行。
The Response.Flush()
is send to the browser what is on buffer, but is not stop the processing of the page, so it will continue the execution of the next steps.
什么是到Response.End()
做的是停止在asp.net页面生命周期的下一个函数调用执行步骤 。 http://msdn.microsoft.com/en-us/library/ms178472.aspx
这就是为什么需要它抛出一个异常,抛出了一系列通话的循环。
And that's why it need to throw an exception, to throw out of the loop of the series of call.
一种选择是 Response.Close()
但是这也没有停止执行的步骤,也许你有一些其他的错误,如果你尝试收盘后送东西与浏览器的连接。如果你这样做 Response.Close()
你也需要做同花顺()
你怎么称呼它,否则浏览器之前被un predictable数据。
One alternative is the Response.Close()
but this also is not stop the execution steps and probably you have some other error if you try to send something after the close of the connection with the browser. if you do Response.Close()
you need to also do Flush()
just before you call it or else browser gets unpredictable data.
您还可以阅读:<一href=\"http://stackoverflow.com/questions/14641143/redirect-to-a-page-with-endresponse-to-true-vs-completerequest-and-security-thre\">Redirect与endResponse为true VS CompleteRequest和安全线页
这篇关于我们可以使用Response.Flush()而不是到Response.End()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!