I have a HttpHandler that I\'m using to handle certain images on a client\'s website. When I\'m outputting the image stream to the response object and call Flush occasionally an
For future readers..
I ran into this case where Response.End() throws an error because the client is disconnected.
An error occurred while communicating with the remote host. The error code is 0x80070057
Oddly a CRLF in the StatusDescription was causing the connection to close.
Response.StatusDescription = ex.Message;
Cannot insert the value NULL into column '', table ''; column does not allow nulls. INSERT fails.\r\nThe statement has been terminated
Removing it fixed my problem.
Response.StatusDescription = ex.Message.Replace("\r\n", " ");