im试图获取页面的源代码,但是某些页面我无法使用
通过C#代码IM获取源代码这是我的代码
private void button1_Click(object sender, EventArgs e)
{
using (var client = new WebClient())
{
string html = client.DownloadString("http://www.acusports.com/roster.aspx?roster=154&path=baseball");
html = textBox1.Text;
}
}
切换以下语句时会发生什么:
html = textBox1.Text;
:
textBox1.Text = html;
在您的代码中,您将html
字符串设置为您检索的任何内容,然后立即用textBox1.Text
的值覆盖它。
您不想写:
textBox1.Text = html;