protected void btnSubmit_Click(object sender, EventArgs e) { if (isValidToRegister()) { string password = txtPassword.Text, email = txtEmail.Text, username = txtUsername.Text; User user = new User(); user.Password = password; user.Email = email; user.UserName = username; try { DL_User userDL = new DL_User(); userDL.SignupAccount(user); Response.Write("<script>alert('Sign up sucessfully!');</script>"); Response.Redirect("Login.aspx"); } catch (Exception ex) { Response.Write("<script>alert('" + ex + "');</script>"); } } }