Esempio n. 1
0
        public static void Login()
        {
            var csrf_token = GetCSRFAsync().Result;

            using (var client = new WebClientEx(_cookies))
            {
                client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                client.Headers[HttpRequestHeader.Referer]     = LoginUrl;
                client.Headers[HttpRequestHeader.UserAgent]   =
                    "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36";

                var reqparm = new NameValueCollection
                {
                    { "form_sent", "1" },
                    { "csrf_token", csrf_token },
                    { "redirect_url", "https://forums.everybodyedits.com/index.php" },
                    { "req_username", "GregBot" },
                    { "req_password", Passwords.ForumPassword },
                    { "save_pass", "1" },
                    { "login", "Login" }
                };
                client.UploadValues(LoginUrl, "post", reqparm);
            }
        }