/// <summary> /// 切换系统语言 /// </summary> /// <returns></returns> public JsonResult SwitchLanguage(string currentLanguage) { var retModel = new JsonReturnModel(); try { if (currentLanguage == "English") { Userinfo.language = "Chinese"; } else { Userinfo.language = "English"; } MemoryCacheUtils.Clear(Userinfo.LoginName); CacheItemPolicy policy = new CacheItemPolicy(); policy.Priority = CacheItemPriority.NotRemovable; MemoryCacheUtils.Set(Userinfo.LoginName, Userinfo, policy); } catch (Exception ex) { retModel.AddError("errorMessage", ex.Message); } return(Json(retModel, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 退出系统 /// </summary> /// <returns></returns> public ActionResult LogOut() { HttpCookie cookie = HttpContext.Request.Cookies["Passport.Token"]; if (cookie != null && !string.IsNullOrEmpty(cookie.Value)) { MemoryCacheUtils.Clear(cookie.Value); cookie.Expires = DateTime.Today.AddDays(-2); Response.Cookies.Add(cookie); Request.Cookies.Remove("Passport.Token"); } return(RedirectToAction("Index", "Login", new { errorStr = "", isAdLogin = false })); }