如何使用asp.net中的页面URL以编程方式阅读html页面的内容? 例如,我需要阅读我的facebook网址的内容,例如:https://www.facebook.com/mano1822
答案 0 :(得分:2)
您必须向相应的URL发出HTTP请求并解析响应。我建议使用this MSDN article作为参考,这也有很好的例子。
编辑: 下面发布的代码来自具体帖子:
WebRequest request = WebRequest.Create("http://testserver/testpage");
//If the target server requires authentication, you have to give some credentials in
//your request object. The way you pass these credentials depends on the authentication
//mechanism of the server...
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream ();
//use dataStream to read data from the server
response.Close();`
希望我帮忙!