WebException远程服务器返回错误: (400) 错误的请求。

来源:互联网 发布:英语书籍阅读软件 编辑:程序博客网 时间:2024/05/05 02:47
try{var rsp = (System.Net.HttpWebResponse)req.GetResponse();//正常情况获取web服务器返回数据}catch (System.Net.WebException ex){Debug.Write(ex.Message);//远程服务器返回错误: (400) 错误的请求。var strResponse = GetResponseAsString((System.Net.HttpWebResponse)ex.Response,encoding);//这样获取web服务器返回数据}


也就是说,异常时,可能服务器也返回了数据


阅读全文
0 0
原创粉丝点击