I've written following method to extract needed html data from web page:
public async System.Threading.Tasks.Task<string> getdata()
{
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
HttpClient client = new HttpClient();
HtmlDocument document = new HtmlDocument();
byte[] htmlb = (await client.GetByteArrayAsync("http://<path-to-cgi>?passwd=" + (string)localSettings.Values["password"] + "&<param>=<hardcoded value>" + "&<param>=<hardcoded value>").ConfigureAwait(false));
document.LoadHtml(Encoding.UTF8.GetString(htmlb,0,htmlb.Length));
var inputs = document.DocumentNode.Descendants("div");
HtmlNode elm = null;
foreach (var input in inputs)
{
if (input.Attributes["id"].ToString() == "main")
{
elm = input;
}
}
return (elm.InnerHtml);
}
And when I execute this method, I get exception that is mentioned above.