获得HttpWebResponse请求的详细错误内容
try { } catch (WebException ex) { HttpWebResponse response = (HttpWebResponse)ex.Response; Console.WriteLine("Error code: {0}", response.StatusCode); using (Stream data = response.GetResponseStream()) { using (StreamReader reader = new StreamReader(data)) { string text = reader.ReadToEnd(); } } }