1

So Response.End() is harmful, how do I flush the response and terminate it? Is this the correct way:

resp.Flush();
resp.Close();
Community
  • 1
  • 1
JontyMC
  • 6,038
  • 6
  • 38
  • 39

1 Answers1

1

Yes, that's correct.

Actually, you don't need resp.Flush() - Close() will flush the response.

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
Sean Reilly
  • 21,526
  • 4
  • 48
  • 62
  • Ok, thanks. This doesn't actually terminate the thread though does it? Should I be doing: resp.Close(); Thread.CurrentThread.Abort(); – JontyMC Aug 13 '09 at 10:16
  • Close also terminates the current thread (it throws an exception under the hood), so you don't need to abort the thread. – Sean Reilly Aug 13 '09 at 15:15