问题描述
我想在C#中执行以下操作:
我之前尝试过此操作
- 使用
WebClient
类下载网站的字符串
WebClient client = new WebClient();
string reply = client.DownloadString(url);
client.DownloadFile(gesamter_String,@"C:\neu\localfile.html");
Console.WriteLine(reply);
- 使用
HTTPClient
类下载网站的字符串
string url = hyperlink;
HttpClient client = new HttpClient();
using (HttpResponseMessage response = client.GetAsync(url).Result)
{
using (HttpContent content = response.Content)
{
string result =content.ReadAsstringAsync().Result;
Console.WriteLine(result);
}
}
但是我的链接有效。我已使用以下链接打开了前台链接:System.Diagnostics.Process.Start(url);
。这个前台打开的站点包含完整的源代码。
非常感谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)