[英]unable to get source code of page aspx webpages
我試圖獲取頁面的源代碼,但某些頁面無法使用C#代碼獲取源代碼
這是我的代碼
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;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.