How to find an asp.net client is disconnected immidiately
问题 I'm aware of Response.IsClientConnected but in my scenario it has a great lag. Code: // sample code for sending a dynamic file in chuncks long bytesSent = 0; while (continueSending) { if (!AskReceiverToContinue()) break; if (!Response.IsClientConnected) break; // Your suggestion goes here... :) try { Response.OutputStream.Write(buffer, 0, buffer.Length); bytesSent += buffer.Length; } Catch { // To my experience, this is more reliable than Response.IsClientConnected continueSending = false; }