Exemplo n.º 1
0
 public bool Logout(string token, string requestid = "")
 {
     try
     {
         _objCacheProvider.Remove(token);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 注销
        /// </summary>
        public bool Logout()
        {
            var token = GetToken();

            if (String.IsNullOrEmpty(token))
            {
                return(true);
            }

            try
            {
                _objCacheProvider.Remove(token);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public ActionResult LogOff()
        {
            ObjCacheProvider <UserAuthSession> objCacheProvider = new ObjCacheProvider <UserAuthSession>();
            string token = string.Empty;

            //Token by QueryString

            if (HttpContext.Request.Cookies[ConstCommon.Token] != null)  //从Cookie读取Token
            {
                token = HttpContext.Request.Cookies[ConstCommon.Token].Value;
            }

            UserAuthSession userSession = objCacheProvider.GetCache(token);

            if (userSession != null && string.IsNullOrEmpty(userSession.Token))
            {
                objCacheProvider.Remove(userSession.Token);
            }
            return(new RedirectResult("/Admin/Account/Login"));
        }