WebClient登录名和密码

时间:2012-08-26 15:20:12

标签: c# webclient

我需要输入用户名/密码到网络https://secure.domaintools.com/log-in/?logout

HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
NameValueCollection nameValues = new NameValueCollection();
ServicePointManager.Expect100Continue = false;
nameValues.Add("username", "ipdnstest@gmail.com");
nameValues.Add("password", "ipdnstest");
using (var wc = new WebClient())
{
    wc.UploadValues("https://secure.domaintools.com/log-in/?logout", nameValues);
    wc.Headers["User-Agent"] = "MOZILLA/5.0 (WINDOWS NT 6.1; WOW64) APPLEWEBKIT/537.1 (KHTML, LIKE GECKO) CHROME/21.0.1180.75 SAFARI/537.1";
    string page = wc.DownloadString("https://secure.domaintools.com/my-account/");
    doc.LoadHtml(page);
    doc.Save("f.htm");
}

但是文件“f.htm”仍然是https://secure.domaintools.com/log-in/?logout网页,所以我没有成功登录

你可以帮帮我吗?登录/密码是真实的。

0 个答案:

没有答案