Имеется веб сайт: http://panel.magic-wow.com/portal/login.php. Пробую пройти авторизацию, но все время нарываюсь на неверный код подтверждения.
| Код | _req = new BReq(); string rep = _req.HttpGet("http://panel.magic-wow.com/portal/login.php"); rep = rep.Substring( rep.IndexOf("securimage_show.php?sid=") + 24, 32 ); StatusErrorLabel.Text = "[" + rep + "]"; pictureBox1.Load("http://magic-wow.com/securimage_show.php?sid=" + rep);
|
| Код | public string HttpPost(string url, string post, string refer = "") { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); request.CookieContainer = cJar; request.UserAgent = UserAgent; request.KeepAlive = true; request.Method = "POST"; request.Referer = refer;
byte[] postBytes = Encoding.ASCII.GetBytes(post); request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream(); requestStream.Write(postBytes, 0, postBytes.Length); requestStream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream());
return sr.ReadToEnd(); }
|
Питаюсь авторизоваться так:
| Код | string reply = null; var post = "login=" + textBox1.Text + "&passwd=" + textBox2.Text + "&code=" + textBox3.Text; try { reply = _req.HttpPost(LoginPage, post); debug(reply); } catch (Exception) { MainStatus.Text = "Login Error"; }
|
|