public override IODataResponseMessage EndGetResponse(IAsyncResult asyncResult) { Debug.Assert(this.httpRequest != null, "this.httpRequest != null"); try { HttpWebResponse httpResponse = (HttpWebResponse)this.httpRequest.EndGetResponse(asyncResult); #if PORTABLELIB if (!httpResponse.SupportsHeaders) { throw new NotSupportedException(Strings.Silverlight_BrowserHttp_NotSupported); } #endif #if !ASTORIA_LIGHT return(new HttpWebResponseMessage(httpResponse)); #else System.Net.HttpWebResponse underlyingHttpResponse = httpResponse.GetUnderlyingHttpResponse(); if (underlyingHttpResponse != null) { return(new HttpWebResponseMessage(underlyingHttpResponse)); } else { HeaderCollection headerCollection = new HeaderCollection(httpResponse.Headers); return(new HttpWebResponseMessage(headerCollection, (int)httpResponse.StatusCode, httpResponse.GetResponseStream)); } #endif } catch (WebException webException) { throw ConvertToDataServiceWebException(webException); } }