忆约科技
位置:首页 > 编程专栏
ASP.NET 显示所有Cookies, Session, Applocation
2018年02月01日 09:58 作者:E小编

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

            // Cookies
            Response.Write("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 />");
            }

            // Application
            Response.Write("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 />");
            }

联系我们| 公司简介| 合资合作| 售后服务
工作机会| 支付方式