protected void btnChangePwd_Click(object sender, EventArgs e) { if (txtconfPwd.Text == txtNewPwd.Text) { //check password validity SSGS_Password_Validator.PwdValidator passwordValidator = new SSGS_Password_Validator.PwdValidator(); if (passwordValidator.PasswdValidation(txtNewPwd.Text)) { //change the password in table SSGS_EMS_Data_Access.EmployeeDataAccess empDataAccess = new SSGS_EMS_Data_Access.EmployeeDataAccess(); if (empDataAccess.ChangePassword(txtNewPwd.Text, Convert.ToInt32(Session["UserId"].ToString()))) { PwdLabel.Text = "Password changed successfully"; } else { PwdLabel.Text = "Password change failed"; } } else { //password does not satisfy conditions so ask to reenter PwdLabel.Text = "password is not valid. need to be between 6 to 10 chars"; } } else { txtNewPwd.Text = ""; txtconfPwd.Text = ""; txtNewPwd.Focus(); } }
protected void LoginButton_Click(object sender, EventArgs e) { SSGS_EMS_Data_Access.EmployeeDataAccess empDataAccess = new SSGS_EMS_Data_Access.EmployeeDataAccess(); int Userid = empDataAccess.AuthLogin(UserName.Text, Password.Text); if (Userid != 0) { //valid user System.Web.Security.FormsAuthentication.SetAuthCookie(UserName.Text, false); Session["UserId"] = Userid; //adding one form for User Information Response.Redirect("../UserInfo.aspx"); } else { //invalid usert } }