string outurl="https://ssl.aukro.cz/enter_login.php"; string session = "ZjZmOVBXCg4DBVMMVgBaVlMAUgkLV18GUgJSWlVWXFEABAULAVcKBwUHBQgCUQxWVwFVCgNVM2Q5Nw=="; string global_login_hash = "19d1f857f0f84ab3cccec54ca9dcac707d55b9f7"; string session_login_hash = "f192efd010b329a84c51cb22d6419623ae778718"; string url = "YmI4OFxGRBFYTRdPQ0UeABcJSlcaUUo0MjBh"; string cod = "OGZkZlVlNmJk"; string version = "A"; string user_login = "loginname"; string user_password = "password"; string commit = "Přihlásit"; private void Login() { WebBrowser b = new WebBrowser(); b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted); b.Navigate(outurl); } private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser b = sender as WebBrowser; string response = b.DocumentText; // unregisters the first event handler // adds a second event handler b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted); b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted2); string postData = string.Format("session={0}&global_login_hash={1}&session_login_hash={2}&url={3}&cod={4}&version={5}&user_login={6}&user_password={7}&submit_orange={8}", session, global_login_hash, session_login_hash, url, cod,version, user_login, user_password, commit); ASCIIEncoding enc = new ASCIIEncoding(); b.Navigate(url, "", enc.GetBytes(postData), "Content-Type: application/x-www-form-urlencoded\r\n"); } private void b_DocumentCompleted2(object sender, WebBrowserDocumentCompletedEventArgs e) { WebBrowser b = sender as WebBrowser; string response = b.DocumentText; if (response.Contains(user_login)) { MessageBox.Show("Login Successful"); } else { MessageBox.Show("error!"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)