Exemplo n.º 1
0
 /// <summary>
 /// 登出
 /// </summary>
 /// <returns></returns>
 public ActionResult Logout()
 {
     Session[CacheKeys.WebUserCacheKey] = null;
     if (!string.IsNullOrWhiteSpace(AccessKey))
     {
         DistributedCache.Delete(string.Format(CacheKeys.UserSessionKey_Arg1, AccessKey));
     }
     return(RedirectToAction("Login"));
 }
Exemplo n.º 2
0
        public ActionResult Delete(string cacheKey, string args)
        {
            var message = new ReturnMessage {
                Success = false, Msg = "操作失败!"
            };

            try
            {
                string key = string.Format(cacheKey, args);
                message.Success = DistributedCache.Delete(key);
                message.Msg     = GetCacheValue(key);
            }
            catch (Exception)
            {
            }
            return(Content(JsonConvert.SerializeObject(message)));
        }