/// <summary> /// 执行登录事件 /// </summary> protected void btnLogin_Click(object sender, EventArgs e) { //根据用户名得到用户密码 string validatePwd = UserManager.GetUserPasswordByUserName(this.txtPassword.Text.Trim()); //加密密码 string inputPwd = CryptogramManager.EncryptPassword(this.txtPassword.Text.Trim()); //通过对比密码,验证登录信息是否正确 if (inputPwd.Trim() == validatePwd.Trim()) { //保存用户身份 userLigon.AuthenticationUsers(this.txtUserName.Text.Trim()); if (!string.IsNullOrEmpty(ReturnUrl)) { Response.Redirect(ReturnUrl); } else { Response.Redirect("Default.aspx"); } } else { this.lblResult.Text = "您输入的用户名或密码不正确!"; } }