ASP.NET 显示所有Cookies, Session, Application

ASP.NET 显示所有Cookies, Session, Application
            // 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 />");
            }

作者最新文章
C# 删除一维数组内的某个值(元素), C# 删除数组元素的方法
C# 如何判断一个字符串是否包含另一个字符串的方法,C# IndexOf 的使用
Winform 只能输入整数的TextBox (文本框) 控件
Winform 禁止重复启动,单实例exe程序
Winform TextBox (文本框) 控件禁止输入内容