-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Workaround for an issue writing response after browser has closed con…
…nection
- Loading branch information
unknown
authored and
unknown
committed
May 20, 2010
1 parent
6eee862
commit 1537210
Showing
1 changed file
with
10 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,16 @@ public void WriteHeaders() | |
HeadersSent = true; | ||
_nativeResponse.ContentLength64 = Headers.ContentLength.GetValueOrDefault(); | ||
|
||
_tempStream.WriteTo(_nativeResponse.OutputStream); | ||
// Guard against a possible HttpListenerException : The specified network name is no longer available | ||
try | ||
{ | ||
_tempStream.WriteTo(_nativeResponse.OutputStream); | ||
} | ||
catch (Exception ex) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
{ | ||
if (_context != null) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
_context.ServerErrors.Add(new Error { Message = ex.ToString() }); | ||
This comment has been minimized.
Sorry, something went wrong.
SteveDunn
|
||
} | ||
} | ||
} | ||
} |
Why not catch a more specific exception?