views:

87

answers:

1

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

resp.Flush();
resp.Close();
+1  A: 

Yes, that's correct.

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

Sean Reilly
Ok, thanks. This doesn't actually terminate the thread though does it? Should I be doing:resp.Close();Thread.CurrentThread.Abort();
JontyMC
Close also terminates the current thread (it throws an exception under the hood), so you don't need to abort the thread.
Sean Reilly