protected void btnSave_Click(object sender, EventArgs e)
    {
      this.lblMessage.Text = "";

      //if (this.txtNewPassword.Text != this.txtNewPasswordConfirm.Text)
      //{
      //  this.lblMessage.Text = "新密码两次输入不一致,请确认!";
      //  return;
      //}

      //if (this.txtNewPassword.Text == "")
      //{
      //  this.lblMessage.Text = "必须输入密码!";
      //  return;
      //}

      Business.UserComponent uc = new UserComponent();
      if (this.txtPassword.Text.Trim().Length == 0 || !uc.VerifyPassword(this.lblUserID.Text, this.txtPassword.Text.Trim()))
      {
        this.lblMessage.Text = "当前密码输入错误,请重新输入!";
        return;
      }

      var user = uc.getUserById(this.hddId.Value);
      user.Psd = this.txtNewPassword.Text;
      if (uc.Update(user) > 0)
      {
        this.lblMessage.Text = "修改密码成功!";
      }
      else
      {
        this.lblMessage.Text = "修改密码失败,请稍后再试!";
      }
    }
        protected void btnLogin_Click(object sender, EventArgs e)
        {

            this.lblMessage.Text = "";

            string userName = this.txtUserID.Text;

            MyPrincipal principal;

            HttpContext.Current.Session.Clear();

            UserComponent uc = new UserComponent();

            if (uc.VerifyPassword(userName, txtPassword.Text))
            {


                principal = new MyPrincipal(userName);

                System.Threading.Thread.CurrentPrincipal = principal;

                HttpContext.Current.Session["JMPrincipal"] = principal;

                HttpContext.Current.User = (MyPrincipal)(HttpContext.Current.Session["JMPrincipal"]);

                try
                {
                    //登陆系统
                    Page.Response.Redirect("Main.aspx");

                    //string url = FormsAuthentication.GetRedirectUrl(userName, true);

                    //Response.Redirect(url);
                    //FormsAuthentication.RedirectFromLoginPage(userName, false);

                }
                catch (Exception ex)
                {
                    throw ex;
                }

                
            }
            else
            {
                this.txtPassword.Text = "";
                this.txtUserID.Text = "";

                this.lblMessage.Text = "用户名或密码输入错误!";

            }
        }