0

这有效,期待,我正在下载登录页面的字符串,而不是实际页面(url 变量)。

如何获取登录后页面的内容?

var credentials = new NetworkCredential { UserName = "xxxxxx", Password = "yyyyyy" };
using (var client = new WebClient())
{
    client.Credentials = credentials;

    string page = client.DownloadString(url);

    if (page.Contains("cheetah"))
    {
         MessageBox.Show("cheetah exists");
    }
    else
    {
         MessageBox.Show("NOPE");
    }
 }
4

1 回答 1

1

尝试

string page = client.DownloadData(url);
于 2012-11-07T19:23:11.997 回答