This project has moved and is read-only. For the latest updates, please go here.
1
Vote

HtmlDocument InnerText (Metro/1.4.6-winrt45)

description

I'm using HtmlDocument to load the contents of an address as html but I get the direction from InnerText.

HtmlDocument doc = new HtmlDocument();
doc.LoadHtml((string)navigationParameter);
string html_doc = doc.DocumentNode.InnerHtml.Replace(" target=\"_blank\"","");
wvBrowser.NavigateToString(html_doc);

I've tried using the code below, but the load method is not available.

HtmlWeb hw = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = hw.Load(currenturl);

comments

Maldy wrote Dec 2, 2012 at 12:23 PM

Finally!, I found the code for load.
        HtmlWeb hw = new HtmlWeb();
        HtmlAgilityPack.HtmlDocument doc = hw.LoadFromWebAsync(url).Result;
But freezes the app, here code how run good.
        HttpClient client = new HttpClient();
        HttpResponseMessage response = client.GetAsync(url).Result;
        response.EnsureSuccessStatusCode();
        string responseBody = response.Content.ReadAsStringAsync().Result;
        doc.LoadHtml(responseBody);

wrote Feb 22, 2013 at 2:46 AM