我一直在尝试向网站发送cookie,这需要我登录才能访问特定页面,只需复制页面数据即可。 我一直在尝试,但没有成功.. - 问题是我不断获取数据,因为我没有登录.. 看看这个:
static void Main(string[] args)
{
Cookie myCookie = new Cookie();
myCookie.Value = "Value"; //Which is the session of the site i am logged in to.
myCookie.Name = "Name"; //Name of the cookie that contains the session mentioned above.
myCookie.Expires = DateTime.Now.AddMinutes(2);
myCookie.Path = "Path";
WebClient client = new WebClient();
string downloadString;
downloadString = client.DownloadString("Same path as myCookie");
}
我最近开始学习这个,所以我的代码可能有点生疏......任何提示都会受到赞赏:)