Response.End() generates ThreadAbortException.
Using HttpContext.Current.ApplicationInstance.CompleteRequest in place of it doesn’t solve the problem.
So, can we use Response.Flush() instead of Response.End()
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.What is
Response.End()do is to stop the execution steps on the next function call in the asp.net Page Life Cycle. http://msdn.microsoft.com/en-us/library/ms178472.aspxAnd that’s why it need to throw an exception, to throw out of the loop of the series of call.
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 doResponse.Close()you need to also doFlush()just before you call it or else browser gets unpredictable data.you can also read : Redirect to a page with endResponse to true VS CompleteRequest and security thread