Tag: scraping webclient httpwebresponse

尝试使用HttpWebRequest获取身份validationcookie

我必须从安全站点刮一张桌子,我无法登录页面并检索身份validation令牌和任何其他相关的cookie。 我在这里做错了吗? public NameValueCollection LoginToDatrose() { var loginUriBuilder = new UriBuilder(); loginUriBuilder.Host = DatroseHostName; loginUriBuilder.Path = BuildURIPath(DatroseBasePath, LOGIN_PAGE); loginUriBuilder.Scheme = “https”; var boundary = Guid.NewGuid().ToString(); var postData = new NameValueCollection(); postData.Add(“LoginName”, DatroseUserName); postData.Add(“Password”, DatrosePassword); var data = Encoding.ASCII.GetBytes(postData.ToQueryString(false)); var request = WebRequest.Create(loginUriBuilder.Uri) as HttpWebRequest; request.Method = “POST”; request.ContentType = “application/x-www-form-urlencoded”; request.ContentLength = data.Length; using (var […]