static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //login loginFrom = new login(); //Application.Run(loginFrom); main mainForm = new main("liaochen" , "3243tsad"); Application.Run(mainForm); }
private void button1_Click(object sender, EventArgs e) { account = tb_account.Text.Trim().ToString(); password = tb_password.Text.Trim().ToString(); //Post post = new Post(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("account={0}&password={1}", account, password); //string result = post.PostLogin("http://localhost/emotive/index.php/Index/login", sb.ToString()); //MessageBox.Show(result); string strURL = "http://localhost/emotive/index.php/Index/login.html?" + sb; System.Net.HttpWebRequest request; // 创建一个HTTP请求 request = (System.Net.HttpWebRequest)WebRequest.Create(strURL); //request.Method="get"; System.Net.HttpWebResponse response; response = (System.Net.HttpWebResponse)request.GetResponse(); System.IO.StreamReader myreader = new System.IO.StreamReader(response.GetResponseStream(), Encoding.UTF8); string responseText = myreader.ReadToEnd(); myreader.Close(); string[] str = json(responseText); if (str[2] == "SUCCESS") { label5.Visible = true; this.label5.Text = "登录成功....."; main mainForm = new main(str[0],str[1]); mainForm.Show(); this.Hide(); } else { label5.Visible = true; this.label5.Text = "账号或密码错误"; } }