public ActionResult Login(Account account) { //if (Session["ValidateCode"].ToString() != account.VerifyCode) //{ // ModelState.AddModelError("VerifyCode", "validate code is error"); // return View(); //} if (!ModelState.IsValid) { return(View()); } if (string.IsNullOrWhiteSpace(account.Name)) { ModelState.AddModelError("Name", "消息:用户名不能为空!"); return(View()); } if (string.IsNullOrWhiteSpace(account.Password)) { ModelState.AddModelError("Name", "消息:密码不能为空!"); return(View()); } MemoryCacheHelper.RemoveCacheAll(); if (!LCLPrincipal.Login(account.Name, account.Password)) { ModelState.AddModelError("Name", "消息:用户或密码错误,请重新输入!"); return(View()); } else { return(RedirectIndex()); } }
public JsonResult AjaxLogin(string name, string password) { var result = new Result(false); if (string.IsNullOrWhiteSpace(name)) { result.Message = "消息:用户名不能为空!"; } if (string.IsNullOrWhiteSpace(password)) { result.Message = "消息:密码不能为空!"; } MemoryCacheHelper.RemoveCacheAll(); if (!RbacPrincipal.Login(name, password)) { result.Message = "消息:用户或密码错误,请重新输入!!"; } else { result = new Result(true); var identity = LEnvironment.Principal as MyFormsPrincipal <MyUserDataPrincipal>; if (identity != null) { //if (identity.DepUserType == 2) //{ // result.Message = "../../" + LCL.MvcExtensions.PageFlowService.PageNodes.FindPageNode("LayoutHome1").Value; //} //else //{ result.Message = "../../" + LCL.MvcExtensions.PageFlowService.PageNodes.FindPageNode("LayoutHome").Value; // } } } return(Json(result, JsonRequestBehavior.AllowGet)); }
public void Execute(object state) { Logger.LogInfo("" + DateTime.Now + "正在执行事件:定时清理缓存"); try { MemoryCacheHelper.RemoveCacheAll(); DbFactory.DBA.ExecuteText("DELETE TLog WHERE AddDate < '" + DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd") + "'"); } catch (Exception ex) { Logger.LogError("ClearCatchEvent", ex); } }
public void RemoveCacheAll() { MemoryCacheHelper.RemoveCacheAll(); }