asp.net遍历缓存、session、cookies、application
//遍历缓存
foreach (DictionaryEntry de in Cache)
{
Response.Write(string.Format("<br>{0}:{1}", de.Key, de.Value));
}
//遍历session
for (int i = 0; i < HttpContext.Current.Session.Count; i++)
{
Response.Write(HttpContext.Current.Session.Keys[i] + ":" + HttpContext.Current.Session[i].ToString() + "<br>");
}
//遍历cookies
for (int i = 0; i < HttpContext.Current.Request.Cookies.Count; i++)
{
Response.Write(HttpContext.Current.Request.Cookies.Keys[i] + ":" + HttpContext.Current.Request.Cookies[i].Value.ToString() + "<br>");
}
//遍历application
Response.Write("ap<br>");
for (int i = 0; i < HttpContext.Current.Application.Count; i++)
{
Response.Write(HttpContext.Current.Application.Keys[i] + ":" + HttpContext.Current.Application[i].ToString() + "<br>");
}