I am trying to get the content from a web page using this code :
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);
But I get this error :
An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set.
You simply need to specify the full URL ( including the protocol) like this:
var response = await http.GetByteArrayAsync("http://www.nsfund.ir/news?p_....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With