问题描述:在使用request.GetResponse时,如果是400错误,将抛出异常信息,而获取不到返回内容,所以返回的内容只能在catch上面获取,转载于
http://blog.csdn.net/ahywg/article/details/26267113
解决方法:
WebRequest request = WebRequest.Create("网址");
Stream stream=null;
try
{
using (WebResponse response = request.GetResponse())
{
stream=response.GetResponseStream();
}
}
catch (WebException e)
{
stream=e.Response.GetResponseStream();
}