protected void Button1_Click(object sender, EventArgs e) { member_home.loginserv.Service1Client r = new member_home.loginserv.Service1Client(); EncDec.Service1 ed_ref = new EncDec.Service1(); r.RegisterService(TextBox1.Text, ed_ref.Encrypt(Password1.Value), DropDownList1.SelectedValue, TextBox2.Text); }
protected void LoginButton_Click(object sender, EventArgs e) { try { member_home.loginserv.Service1Client client = new member_home.loginserv.Service1Client(); EncDec.Service1 ed = new EncDec.Service1(); string encPswd = ed.Encrypt(Password.Text); if (TextBox1.Text.Equals(verfy_string)) { bool result = client.checkUser(Username.Text, encPswd, DropDownList1.SelectedValue); if (result) { HttpCookie usercookie = new HttpCookie("data"); usercookie["username"] = Username.Text; usercookie["Role"] = DropDownList1.SelectedValue; usercookie.Expires = System.DateTime.Now.AddDays(30); Response.Cookies.Add(usercookie); string page = DropDownList1.SelectedValue.ToLower() + "_home.aspx"; Response.Redirect(page); } else { Label1.Text = "Login failed!"; Label2.Text = "Username or Password Incorrect."; captcha_generation(); TextBox1.Text = ""; } } else { TextBox1.Text = ""; captcha_generation(); Label1.Text = ""; Label2.Text = "Enter Correct Captcha!"; } } catch (Exception ex) { captcha_generation(); Label1.Text = "Error!" + ex.ToString(); } }