What are the advantage and disadvantage for each of Response.End()
and CompleteRequest()
? Where should I and should I not use them? I looked at this qu
HttpResponse.End
flushes the output buffer to the client and terminates the current request-handling thread (this is bad), whereas HttpApplication.CompleteRequest
tells ASP.NET to immediately skip all future stages in the ASP.NET pipeline and jump directly to the EndRequest step (which also raises the HttpApplication.EndRequest
event). The request thread then proceeds with normal end-of-life cleanup.
So, Response.End
is like an ejector seat: it quickly ends things, but means you lose control and might be unnecessarily harsh. Whereas CompleteRequest
is like making an emergency landing at the nearest airport.