Asp.Net 遍历 循环 显示所有COOKIS,SESSION,Applocation

在C#中循环显示SESSIOn:

Response.Write("<br>Session的所有值:<br>");
        foreach (string obj in Session.Contents)
        {
            Response.Write(obj.ToString() + ":" + Session[obj] + "<br>");
        }

在C#中循环显示CookiEs:
        Response.Write("<br>CookiEs的所有值:<br>");

        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>");

        }


在C#中循环显示Application:

        Response.Write("<br>Application的所有值:<br>");

        for (int i = 0; i < HttpContext.Current.Application.Count; i++)
        {

            Response.Write(HttpContext.Current.Application.Keys[i] + ":" + HttpContext.Current.Application[i].ToString() + "<br>");

        }

posted @ 2010-08-06 13:59  与时俱进  阅读(1952)  评论(0编辑  收藏  举报
友情链接:同里老宅院民居客栈