protected void btnChange_Click(object sender, EventArgs e) { try { if (ValidateSave()) { Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster(); Entity.HR.EmployeeMaster employeeMaster = new Entity.HR.EmployeeMaster(); employeeMaster.EmployeeMasterId = (Business.Common.Context.EmployeeId == 0) ? Convert.ToInt32(HttpContext.Current.User.Identity.Name) : Business.Common.Context.EmployeeId; employeeMaster.Password = txtNewPassword.Text.Trim().EncodePasswordToBase64(); int employeeId = 0; employeeId = objEmployeeMaster.HR_PasswordReset_Save(employeeMaster); if (employeeId > 0) { lblMessage.InnerText = "Password changed."; Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Thread.Sleep(2000); System.Web.Security.FormsAuthentication.SignOut(); System.Web.Security.FormsAuthentication.RedirectToLoginPage(); } else { lblMessage.InnerText = "Failed to save data."; } } } catch (Exception ex) { ex.WriteException(); lblMessage.InnerText = ex.Message; } }