从HttpContext.current.cache获取所有值 [英] Get all the values from HttpContext.current.cache
本文介绍了从HttpContext.current.cache获取所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请让我知道如何从HttpContext.Current.Cache
作为
获取所有值
我不知道要在HttpContext.Current.Cache
的get方法中指定的键名
即HttpContext.Current.Cache.Get
Hi ,
please let me know how to Get all the values from HttpContext.Current.Cache
as
i doesn"t know the keyname to specify in get method of HttpContext.Current.Cache
ie HttpContext.Current.Cache.Get
推荐答案
尝试这种方式
Try that way
foreach (DictionaryEntry item in HttpContext.Current.Cache)
{
Response.Write("Key " + item.Key + ", Value " + item.Value);
}
尝试类似以下代码.
Try like following code.
IDictionaryEnumerator CacheEnum = HttpContext.Current.Cache.GetEnumerator();
while (CacheEnum.MoveNext())
{
var cacheItem = Server.HtmlEncode(CacheEnum.Current.ToString());
Response.Write(cacheItem);
}
这篇关于从HttpContext.current.cache获取所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文