日期:2014-05-18  浏览次数:20475 次

得到所有Cookie
如何得到客户端的所有Cookie并把他们列出来?

------解决方案--------------------
得到其他网站的cookie貌似不可能..

得到本网站写的所有cookie

请参考
HttpCookie c;
string subKeyName;
string subKeyValue;
for(int i = 0; i < Request.Cookies.Count;i++)
{
c = Request.Cookies[i];
if (c.HasKeys)
{
for (int j = 0; j < c.Values.Count - 1; j++ )
{
subKeyName = Server.HtmlEncode(c.Values.AllKeys[j]);
subKeyValue = Server.HtmlEncode(c.Values[j]);
Response.Write( "subKeyName = " + subKeyName + ", subKeyValue = " + subKeyValue + " <br /> ");
}
}
else
Response.Write(c.Name + " " + c.Value + " <br /> ");
}