Reputation: 20078
I am trying this in Visual Studio 11 in Windows 8. As I see I can't use WebClient
to do this, so I tried using HttpClient
:
var client = new HttpClient();
var response = client.Get("http://google.com");
var result = XDocument.Parse(response.Content.ReadAsString());
My problem is that I always get result to be null. In response I get a status code 200 (OK) but I can't see the content.
What am I doing wrong ?
Thanks.
Upvotes: 0
Views: 56
Reputation: 888283
Most webpages are not valid XML.
You should use HTML Agility Pack instead.
Upvotes: 1