protected void btnAccess_Click(object sender, EventArgs e) { if (Page.IsValid) { string opass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtCpass.Text, "SHA1"); var oldpass = new ServiceReference1.Service1Client().Get_User_By_UserName_v2(Session["username"].ToString()).Password; if (opass != oldpass) { ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Current Password is incorrect !!!');", true); } else { ServiceReference1.User user = new ServiceReference1.User(); user.Username = Session["username"].ToString(); string pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtNpass.Text, "SHA1"); user.Password = pass; ServiceReference1.Service1Client sr = new ServiceReference1.Service1Client(); if (sr.Update_Password(user) == 1) { ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Change successed !!!');", true); Binding_data(); } else { ScriptManager.RegisterStartupScript(this, GetType(), "Thông báo", "alert('Error: Try again !!!');", true); } } } }