无法获取页面ASPX网页的源代码



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; 

最新更新