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 @ 2016-02-22 11:40  Akgu  阅读(492)  评论(0编辑  收藏  举报