/// <summary> /// 登录 /// </summary> /// <returns></returns> public ActionResult Index() { HttpCookie cookie = Request.Cookies["USERINFO"]; if (cookie == null) { return(View()); } string USERNAME = cookie.Values["USERNAME"]; string PASSWORD = cookie.Values["PASSWORD"]; if (string.IsNullOrEmpty(USERNAME) || string.IsNullOrEmpty(PASSWORD)) { cookie.Expires = DateTime.Now.AddDays(-30); Response.AppendCookie(cookie); } else { var usersBll = new UsersBll(); var item = usersBll.LoginUsers(HashEncrypt.DecryptQueryString(USERNAME), HashEncrypt.DecryptQueryString(PASSWORD)); if (item != null) { Session["USERID"] = HashEncrypt.EncryptQueryString(item.UserID.ToString()); return(RedirectPermanent("../Home/Index")); } else { cookie.Expires = DateTime.Now.AddDays(-30); Response.AppendCookie(cookie); } } return(View()); }