private static void VoteFor(string candidateId) { var uri = new Uri("http://bla/huiCoffee/voteSubmit"); try { using (var webClient = new CookieWebClient()) { var document = webClient.DownloadString("http://bla/huiCoffee/voteIndex"); var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(document); var id = htmlDoc.DocumentNode.Descendants("input").FirstOrDefault(d => d.Attributes["id"].Value == "uky").Attributes["value"].Value; var votes = htmlDoc.DocumentNode.Descendants("label").FirstOrDefault(d => d.Attributes["applicantid"].Value == candidateId).InnerText; webClient.CookieContainer.Add(new Cookie("voterId", id) { Domain = "www.huilc.cn" }); Console.WriteLine("Current Votes: " + candidateId + " - " + votes); for (var i = 0; i < 10; i++) { using (var postClient = new CookieWebClient()) { var cookie = webClient.CookieContainer.GetCookies(new Uri("http://bla/huiCoffee/voteSubmit")); postClient.CookieContainer.Add(cookie); try { var values = new NameValueCollection { { "voterId", id }, { "applyId", candidateId } }; postClient.UploadValues(uri, "POST", values); } catch (Exception ex) { //Console.WriteLine(ex.Message); //Console.ForegroundColor = ConsoleColor.Red; //Console.Write("x "); //Console.ResetColor(); } } } } } catch (Exception) { } }