轻松实现asp.net中遍历cookies,session,application,小总结
Posted on 2009-04-24 09:49 且行且思 阅读(1313) 评论(0) 编辑 收藏 举报
//遍历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>");
}
//遍历session
for (int i = 0; i < HttpContext.Current.Session.Count; i++)
{
Response.Write(HttpContext.Current.Session.Keys[i] + ":" + HttpContext.Current.Session[i].ToString() + "<br>");
}
//遍历application
for (int i = 0; i < HttpContext.Current.Application.Count; i++)
{
Response.Write(HttpContext.Current.Application.Keys[i] + ":" + HttpContext.Current.Application[i].ToString() + "<br>");
}