private static string ReadStreamFromResponse(WebResponse response) { using (var stream = response.GetResponseStream()) { if (stream != null) { using (var sr = new StreamReader(stream)) { return sr.ReadToEnd(); } } } return null; }