• MVC第三波书店登录


     

     #region 登录
            [HttpGet]
            public ActionResult Login()
            {
                return View();
            }
            [HttpPost]
            public ActionResult Login(UserInfo users)
            {

                if (!users.CheckNo.ToLower().Equals(TempData["code"].ToString()))
                {
                    return Content("");
                }
                else
                {
                    //记住用户名和密码
                    if (!string.IsNullOrEmpty(users.Removeme))
                    {
                        HttpCookie IdCookie = new HttpCookie("loginId", users.AccountNum);
                        IdCookie.Expires = DateTime.MaxValue;
                        IdCookie.HttpOnly = true;
                        Response.Cookies.Add(IdCookie);
                        HttpCookie PwdCookie = new HttpCookie("loginPwd", users.PassWord);
                        PwdCookie.Expires = DateTime.MaxValue;
                        PwdCookie.HttpOnly = true;
                        Response.Cookies.Add(PwdCookie);
                    }
                    else
                    {
                        Response.Cookies["loginId"].Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies["loginPwd"].Expires = DateTime.Now.AddDays(-1);
                    }
                    return  RedirectToAction("Index");
                }
            }

            
          
            #endregion

    #region 登录
            [HttpGet]
            public ActionResult Login()
            {
                return View();
            }
            [HttpPost]
            public ActionResult Login(UserInfo users)
            {

                if (!users.CheckNo.ToLower().Equals(TempData["code"].ToString()))
                {
                    return Content("");
                }
                else
                {
                    //记住用户名和密码
                    if (!string.IsNullOrEmpty(users.Removeme))
                    {
                        HttpCookie IdCookie = new HttpCookie("loginId", users.AccountNum);
                        IdCookie.Expires = DateTime.MaxValue;
                        IdCookie.HttpOnly = true;
                        Response.Cookies.Add(IdCookie);
                        HttpCookie PwdCookie = new HttpCookie("loginPwd", users.PassWord);
                        PwdCookie.Expires = DateTime.MaxValue;
                        PwdCookie.HttpOnly = true;
                        Response.Cookies.Add(PwdCookie);
                    }
                    else
                    {
                        Response.Cookies["loginId"].Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies["loginPwd"].Expires = DateTime.Now.AddDays(-1);
                    }
                    return  RedirectToAction("Index");
                }
            }

            
          
            #endregion

  • 相关阅读:
    使用rpm重新安装包
    商家收款码手续费太高了
    面向对象开发技术设计模式的选择
    通过document集合属性获取标签对象
    青阳网络文件传输系统 kiftd 1.1.0 正式发布!
    鱼和熊掌可以兼得!天翼云弹性裸金属一招鲜
    SNP Glue:SAP数据导入到其他系统的多种方式
    基于费舍尔判别分析的故障与诊断(lunwen+文献综述+翻译及原文+MATLAB程序)
    Deepwalk详解
    MATLAB2016笔记(十):曲线拟合、参数估计
  • 原文地址:https://blog.csdn.net/m0_74456535/article/details/127874538