创建一个程序在button按钮的事件中,写下
private string url = http://www.baidu.com/;
private WebClient wc = new WebClient();
private void button1_Click(object sender, EventArgs e)
{
string articleData = Encoding.UTF8.GetString(wc.DownloadData(string.Format(url)));
string pth = Path.GetFullPath(Properties.Settings.Default.ToString()) + ".txt";
if (!File.Exists(pth))
File.AppendAllText(pth, articleData, Encoding.UTF8);
}
抓取到整个页面的html。