protected void btnUpdateEmail_ServerClick(object sender, EventArgs e) { UserService.UserCRUDClient service = new UserService.UserCRUDClient(); service.Open(); Object[] ds = service.Authenticate(txtOldEmail.Value, Security.HashPassword(txtUserPass.Value)); service.Close(); service = null; if (!(ds == null)) { if (txtNewEmail.Value.Equals(txtNewEmailConfirm.Value)) { UserService.UserCRUDClient UserCRUDService = new UserService.UserCRUDClient(); UserCRUDService.Open(); int result = 0; result = UserCRUDService.updateUserEmail(((UserData)Session["User"]).getID(), Security.HashPassword(txtUserPass.Value), txtOldEmail.Value, txtNewEmailConfirm.Value); UserCRUDService.Close(); if (result == 1) { Session["User"] = null; changeCard(); } else { invalidEmailUpdate.InnerHtml = "<p>An error occured<br/>Please make sure you enter your correct current email address and password</p>"; } } else { invalidEmailUpdate.InnerHtml = "<p>Please make sure you confirm your new email address</p>"; } } else { invalidEmailUpdate.InnerHtml = "<p>Invalid account details<br/>Please make sure you enter your current email address and password</p>"; } }