如何获得防伪标记

时间:2013-03-08 10:52:32

标签: c#

您好我需要测试下载链接,我需要登录,当我尝试使用以下代码登录时,我会重定向回错误页面,因为我没有防伪令牌,你能告诉我吗?如何获得防伪标记,我对此事先感谢新手

//Make a post to LoginTest page
HttpWebRequest request = WebRequest.Create(loginUrlwith the login credential ) as HttpWebRequest;
request.Method = "HEAD";
HttpWebResponse response = request.GetResponse() as HttpWebResponse;

HttpWebRequest request2 = WebRequest.Create(downloadurl) as HttpWebRequest;
request2.CookieContainer = new CookieContainer();
request2.CookieContainer.Add(response.Cookies);
HttpWebResponse response2 = request2.GetResponse() as HttpWebResponse;

0 个答案:

没有答案