从 asp.net 中给定的 url 获取所有 Html 内容

Get all Html content from given url in asp.net

我正在 asp.net 中创建一个应用程序,我想制作一个功能,我可以从给定的 url 中获取所有 html 内容。

就像我把 link www.whosebug.com

给出了Whosebug的全部内容。是否可以在 asp.net.

中实现此功能

如果,请帮助我。

谢谢

你必须有办法做到这一点..

第一个

var webRequest = WebRequest.Create(@"http://whosebug.com");

using (var response = webRequest.GetResponse())
using(var content = response.GetResponseStream())
using(var reader = new StreamReader(content)){
    var strContent = reader.ReadToEnd();
} 

第二

var result = string.Empty;
using (var webClient = new System.Net.WebClient())
{
    result = webClient.DownloadString("http://some.url");
}

希望对您有所帮助