protected void btn_Register_Submit(object sender, EventArgs e) { string theUser = txtRegisterEmail.Text.Trim(); string thePass = txtRegisterPassword.Text.Trim(); string theName = txtRegisterName.Text.Trim(); string thePass2 = txtRegisterPassword2.Text.Trim(); string theEmail = txtRegisterEmailAddress.Text.Trim(); ServiceReference4.Service1Client client = new ServiceReference4.Service1Client(); localhost.Service1 get = new localhost.Service1(); if (validationcheck(theUser, thePass, thePass2, theName) == true) { //string newPass = passHash(thePass); get.userRegister(theUser, thePass, thePass2, theName, theEmail); int profid = client.getprofileID(theUser); Session["user"] = theUser; Session["id"] = profid; //MailMessage mail = new MailMessage(); //mail.To.Add(theEmail); //mail.From = new MailAddress("*****@*****.**"); //mail.Subject = "Welcome!" + theUser; //mail.Body = "Hello!"; //mail.IsBodyHtml = true; //SmtpClient smtp = new SmtpClient(); //smtp.Host = "smtp.mail.yahoo.com"; //smtp.Credentials = new System.Net.NetworkCredential // ("*****@*****.**", "ukraine1990"); //smtp.Port = 587; //smtp.EnableSsl = true; //smtp.Send(mail); Response.Redirect("~/MyProfile.aspx"); } }
protected void loginSubmit_Click(object sender, EventArgs e) { string theUser = txtUserName.Text.ToString().Trim(); string thePass = txtPassword.Text.ToString().Trim(); //string newPass = passHash(thePass); ServiceReference4.Service1Client get = new ServiceReference4.Service1Client(); Int32 login = get.loginUser(theUser, thePass); if (login == 1) { int profid = get.getprofileID(theUser); Session["id"] = profid; Session["user"] = theUser; LblResult.Text = "success" + Session["id"] + Session["user"]; Response.Redirect("MyProfile.aspx"); } else if (login == -1) { Response.Redirect("Login.aspx"); Response.Write("<script>alert('Incorrect User Name')</script>"); LblResult.Text = "username"; } else { Response.Redirect("Login.aspx"); Response.Write("<script>alert('Incorrect Password')</script>"); LblResult.Text = "password"; } }