diff --git a/Source/Csla/DataPortalClient/HttpProxy.cs b/Source/Csla/DataPortalClient/HttpProxy.cs index 6b6de07e67..113ff85390 100644 --- a/Source/Csla/DataPortalClient/HttpProxy.cs +++ b/Source/Csla/DataPortalClient/HttpProxy.cs @@ -159,8 +159,16 @@ private byte[] CallViaWebClient(byte[] serialized, string operation, string rout catch (WebException ex) { string message; - using (var reader = new System.IO.StreamReader(ex.Response.GetResponseStream())) - message = reader.ReadToEnd(); + if (ex.Response != null) + { + using (var reader = new System.IO.StreamReader(ex.Response.GetResponseStream())) + message = reader.ReadToEnd(); + } + else + { + message = ex.Message; + } + throw new DataPortalException(message, ex); } }