protected void btnRegister_Click(object sender, EventArgs e) { // read values from the text fields string username = txtUsername.Text.Trim(); string password = Encryptor.EncryptText(txtPassword.Text.Trim()); string passwordCon = Encryptor.EncryptText(txtConfirmPassword.Text.Trim()); if (!password.Equals(passwordCon)) { lblMessage.Text = "Passwords do not match. Please try again."; lblMessage.ForeColor = System.Drawing.Color.Red; return; } AuthenticationLogic al = new AuthenticationLogic(); User user = al.GetUserByName(username); if (user != null) { lblMessage.Text = "Username is taken. Please try again."; lblMessage.ForeColor = System.Drawing.Color.Red; return; } if (al.CreateUser(new User(0, username, password, "Member", "")) == 1) { lblMessage.Text = "Registration Complete!"; lblMessage.ForeColor = System.Drawing.Color.Green; return; } }