asp.net 如何读取当前浏览器中的cookie的所有记录~急~

2024-12-14 09:30:25
推荐回答(3个)
回答1:

其他网站的Cookie是不能获取的,但可以获取本网站的所有Cookie。代码如下:
int n,m = 0;
n = Request.Cookies.Count;
Label1.Text = "目前共定义了" + n.ToString() + "个Cookie";
HttpCookie mycookie;
if (n > 0)
{
Label1.Text += ":";
foreach (string CookieName in Request.Cookies)
{
mycookie = Request.Cookies[CookieName];
Label1.Text += "
Cookie “";
Label1.Text += CookieName + "” 中含有";
m = mycookie.Values.Count;
Label1.Text += m.ToString() + "个Key";
if (m > 0)
{
Label1.Text += ":";
foreach (string s in mycookie.Values)
{
Label1.Text += " “" + s + "”=" + mycookie[s].ToString() + ";";
}
}
}
}

回答2:

下个 职业民工 插件 ,一切OK

回答3:

你知道coolie名吗?