使用client.DownloadString并再次返回HTML

时间:2016-01-11 22:33:02

标签: c# html string client downloadstring

我使用C#windows form app,我想下载内容网站,编辑后在外部浏览器中显示。

WebClient client = new WebClient();
string s = client.DownloadString("http://google.com");

如何在外部浏览器中显示String html? 方面。

1 个答案:

答案 0 :(得分:0)

WebClient client = new WebClient();
string s = client.DownloadString("http://google.com");
Process.Start("http://www.google.com");

如果你想让它更复杂一些,可以将它保存到本地文件,并通过Process.Start()函数在外部浏览器中打开它。

WebClient client = new WebClient();
string s = client.DownloadString("http://google.com");
StreamWriter sw = File.CreateText("google.html");
sw.Write(s);
sw.Close();
Process.Start("google.html");