【发布时间】:2016-01-16 11:37:23
【问题描述】:
我正在尝试使用此代码从网页获取内容:
HttpClient http = new HttpClient();
var response = await http.GetByteArrayAsync("www.nsfund.ir/news?p_p_id=56_INSTANCE_tVzMoLp4zfGh&_56_INSTANCE_tVzMoLp4zfGh_mode=news&_56_INSTANCE_tVzMoLp4zfGh_newsId=3135919&p_p_state=maximized");
String source = Encoding.GetEncoding("utf-8").GetString(response, 0, response.Length - 1);
source = WebUtility.HtmlDecode(source);
HtmlDocument resultat = new HtmlDocument();
resultat.LoadHtml(source);
但我收到此错误:
提供的请求 URI 无效。请求 URI 必须是绝对 URI,或者必须设置 BaseAddress。
【问题讨论】:
-
试试
http://www.......
标签: c# http httpclient