Get rid of ThreadAbortException with httpResponse.End
Does anyone know how to replace httpResponse.End()
with something that doesn't throw ThreadAbortException
causing performance issues? Someone suggested doing "HttpContext.Current.ApplicationInstance.CompleteRequest ()", but that doesn't do everything it does httpResponse.End()
like sending buffered data to the client, which is a problem for me.
source to share
First, I doubt this is really causing serious problems. However, this is not a great idea at all ... it's actually an abuse of exceptions. (IMO, anyway.)
From the documentation :
This method is provided for ASP compatibility only, that is, for compatibility with the COM-based web programming technology that predates ASP.NET. If you want to go to the EndRequest event and send a response to the client, call
CompleteRequest
.
Obviously the current method will still continue after being called CompleteRequest
, so you will need to make sure that you have fully handled the current event.
source to share