Xamarin如何从aspx网页中提取数据

时间:2017-04-09 05:46:36

标签: c# asp.net json xamarin

首先,我对此很新,所以请原谅我,如果我问一个无聊的问题。我正在使用Xamarin Forms并尝试从网页获取一些表格数据。这是我目前的代码块:

private async Task GetTheData()
{
    try
    {
        string requestUrl = "http://www.ahpra.gov.au/Registration/Registers-of-Practitioners.aspx?reg=NMW0001317068";
        HttpClient client = new HttpClient();
        var response = await client.GetStreamAsync(requestUrl);
        StreamReader streamReader = new StreamReader(response);
        string contentResponse = streamReader.ReadToEnd();
        var obj = JsonConvert.DeserializeObject(contentResponse);
        Debug.WriteLine(obj);
    }
    catch(Exception ex)
    {
        Debug.WriteLine(ex.Message);
    }
}

异常给我日志:

[0:] Unexpected character encountered while parsing value: <. Path '', line 0, position 0.

我正在尝试从页面获取数据并将其拉出来。我一直在尝试进行一些研究,但似乎无法找到有关如何从.aspx页面提取数据的任何信息。

提前致谢。

1 个答案:

答案 0 :(得分:0)

浏览此链接....
Pulling data from a webpage, parsing it for specific pieces, and displaying it
希望你解决问题.........