在asp.net中遍曆cookies,session,application

        //遍曆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>");     
        }

posted on 2007-08-20 16:20  感動常在  阅读(1557)  评论(0编辑  收藏  举报