//拿到验证码后,执行登录 public void DoRelogin(string verifyCode) { string data = "j_username="******"&j_password="******"&codeVal=" + verifyCode; string response = JingKongHttp.DoPostHttps("https://119.4.99.217:7300/mcrm/j_spring_security_check", data, Application.StartupPath, "https://119.4.99.217:7300/mcrm/login.jsp"); if (response.IndexOf("<div class=\"alert alert-danger\" style=\"margin: 0px;\">验证码错误</div>") > -1) { //MessageBox.Show("重登录失败,验证码" + verifyCode + "错误"); UploadVerifyCode(); } else { //if (response.IndexOf("您的密码已经过期,请修改您的初始密码") > -1) { // MessageBox.Show("金控密码已经过期"); // this.Close(); // return; //} loginOutime = false; EvalAction <string>("Home.RegisterClient", posPlatForm); registed = true; //继续监控 触发查询ToolStripMenuItem_Click(null, null); } }
private static void testAutoLogin() { JingKongHttp.DoGet("https://119.4.99.217:7300/mcrm/login.jsp"); Random MyRandom = new Random(); int RandomNum = MyRandom.Next(100000000, 999999999); string url = "https://119.4.99.217:7300/mcrm/code/code?" + RandomNum; string filePath = "d:\\aaaaaaaa.jpg"; string basePath = @"D:\QuickDisk\MyWork\yiletong\output"; JingKongHttp.Download(url, filePath, basePath, "https://119.4.99.217:7300/mcrm/j_spring_security_check"); Console.WriteLine("download ok, please input the code"); string code = Console.ReadLine(); string data = "j_username=福州易乐通&j_password=Ylt123456&codeVal=" + code; string response = JingKongHttp.DoPostHttps("https://119.4.99.217:7300/mcrm/j_spring_security_check", data, basePath, "https://119.4.99.217:7300/mcrm/login.jsp"); if (response.IndexOf("<div class=\"alert alert-danger\" style=\"margin: 0px;\">验证码错误</div>") > -1) { Console.WriteLine("重登录失败,验证码" + code + "错误"); testAutoLogin(); } }