コード例 #1
0
        protected void IbLogin_Click(object sender, ImageClickEventArgs e)
        {
            this.lblMessage.Text = "";
            //登陆成功需要记录用户ID,用户名,用户权限
            string strUserName  = this.txtLogin.Text;
            string strPassword  = this.txtPwd.Text;
            string strCheckCode = this.txtCheckCode.Text;

            if (strUserName == "" || strPassword == "" || strCheckCode == "")
            {
                this.lblMessage.Text = "请输入完整的登陆信息!";
                return;
            }

            if (Session["checkCode"] != null && Session["checkCode"].ToString() == strCheckCode)
            {
                strPassword = sys.Encrypt(strPassword);
                modeladmin  = blladmin.GetAdminInfo(strUserName, strPassword);
                if (modeladmin != null)
                {
                    currentAdmin.Name = modeladmin.dbo_UserName.ToString();
                    // CurrentAdmin = sdr["userName"].ToString();

                    currentAdmin.Id       = modeladmin.ID.ToString();
                    currentAdmin.strPower = modeladmin.dbo_Power.ToString();
                    blladmin.UserLoginAccess(Convert.ToInt32(currentAdmin.Id));
                    //Response.Write(sys.CurrentAdminPower);
                    Response.Redirect("default.aspx");
                }
                else
                {
                    this.lblMessage.Text = "用户名或密码错误!";
                }
            }
            else
            {
                this.lblMessage.Text = "验证码输入错误!";
            }
        }