public string PromptUpdatePwdSuccess = string.Empty; //密码修改成功!

    #endregion Fields

    #region Methods

    protected void btnOk_Click(object sender, EventArgs e)
    {
        string userid = this.txtUserID.Text;
           string oldPassword = this.txtOldPassword.Text;

           CommonFunction comFun = new CommonFunction();
           oldPassword = comFun.setMD5Password(oldPassword);

           string resultDspName = comFun.checkLogin(userid, oldPassword);//登录人显示名
           if (string.IsNullOrEmpty(resultDspName) == true)
           {
           this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "oldpassword", "alert('" + PromptOldPwdError + "');", true);
            return;
           }

           string newPassword = this.txtNewPassword.Text.Trim();
           string confimrPassword = this.txtConfirmPassword.Text.Trim();

           newPassword = comFun.setMD5Password(newPassword);

           int i = updatePassword(userid, newPassword);
           if (i == 1)
           {
           this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "success", "alert('" + PromptUpdatePwdSuccess + "');", true);
           }
           else
           {
           this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "fail", "alert('" + PromptUpdatePwdFaild + "');", true);
           return;
           }
    }
    private void Login_KFCUser()
    {
        //string strUserAccount = this.txtUserID.Text.Trim();//登录人账户
        //string strPwd = this.txtPwd.Text.Trim();//登录人密码
        //CommonFunction comFun = new CommonFunction();

        //strPwd = comFun.setMD5Password(strPwd);//md5加密

        //string resultDspName = comFun.checkLogin(strUserAccount, strPwd);//登录人显示名
        //if (!string.IsNullOrEmpty(resultDspName))
        //{
        //    comFun.setSesssionAndCookies(strUserAccount,resultDspName);
        //    this.Response.Redirect("~/Default.aspx");
        //}
        //else
        //{
        //    this.lblRegMsgPopup.Text = "登录失败!";
        //    return;
        //}

        string strUserAccount = this.txtUserID.Text.Trim();//登录人账户
        string strPwd = this.txtPwd.Text.Trim();//登录人密码
        CommonFunction comFun = new CommonFunction();
        strPwd = comFun.setMD5Password(strPwd);//md5加密

        string strTemp = comFun.checkLogin(strUserAccount, strPwd);
        string resultDspName = strTemp.Split(',')[1];//登录人显示名
        strUserAccount = strTemp.Split(',')[0];
        if (!string.IsNullOrEmpty(resultDspName))
        {
            //System.Web.Security.FormsAuthentication.SetAuthCookie(strUserAccount, false);
            FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, "LoginCookieInfo", DateTime.Now, DateTime.Now.AddMinutes(60), false, strUserAccount); // User data
            string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //加密
            //   存入Cookie
            HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            authCookie.Expires = authTicket.Expiration;
            Response.Cookies.Add(authCookie);

            if (chkRemember.Checked)//再写入cookie
            {
                if (Request.Cookies["RememberMe"] == null || String.IsNullOrEmpty(Response.Cookies["RememberMe"].Value))
                {
                    Response.Cookies["RememberMe"].Value = HttpUtility.UrlEncode(strUserAccount, System.Text.Encoding.GetEncoding("gb2312"));
                    Response.Cookies["RememberMe"].Expires = DateTime.Now.AddMonths(1);
                }
            }
            else
            {
                if (Response.Cookies["RememberMe"] != null) Response.Cookies["RememberMe"].Expires = DateTime.Now.AddDays(-1);//删除
            }

            comFun.setSesssionAndCookies(strUserAccount, resultDspName, "");

            this.Response.Redirect("~/Default.aspx");
            //if (Request.QueryString.ToString().Contains("ReturnUrl") && !String.IsNullOrEmpty(Request.QueryString["ReturnUrl"].ToString()))
            //{
            //    this.Response.Redirect(Request.QueryString["ReturnUrl"].ToString());
            //}
            //else
            //{
            //    this.Response.Redirect("~/Default.aspx");
            //}
        }
        else
        {
            this.lblRegMsgPopup.Text = "登录失败!";
            return;
        }
    }