代码

/// <summary>
        /// 清除所有Cookie
        /// </summary>
        public static void RemoveAll()
        {
            System.Web.Caching.Cache _cache = HttpRuntime.Cache;
            IDictionaryEnumerator CacheEnum = _cache.GetEnumerator();
            ArrayList al = new ArrayList();
            while (CacheEnum.MoveNext())
            {
                al.Add(CacheEnum.Key);
            }

            foreach (string key in al)
            {
                _cache.Remove(key);
            }
        }

 

posted on 2017-05-18 17:14  邢帅杰  阅读(1128)  评论(0编辑  收藏  举报