<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://www.jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://www.jackxiang.com/post//</link>
<title><![CDATA[[原创]在InternetExplorer中对Cookie数目的多少和cookie字节数的大小限制的处理（翻译自微软英文文档）]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[生活笔记]]></category>
<pubDate>Tue, 27 May 2008 08:23:36 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：有哥们在一PHP群里发现另一个哥们设置cookie的代码编写有点意思，如下：<br/>[codes=php]<br/>$cookieJson = json_encode($cookieArr);<br/>$_COOKIE[&#039;userInfo&#039;.$this-&gt;roteId] = $cookieJson;<br/>setcookie(&#039;userInfo&#039;.$this-&gt;roteId,$cookieJson );<br/>[/codes]<br/><br/>为何会超cookie呢，cookie和session一样也有大小限定的，浏览器不一样的大小，于浏览器相关，但大小是必须有限定的，还和网站有多少个cookie的限定，如下：<br/>服务器session才会超。cookie是放浏览器里的。<br/>大多数 浏览器都是4K的,4096字节的COOKIE.<br/>目测COOKIE数量也只有20个吧 最多一个站点的COOKIE数量。<br/><br/><br/>尽管有微软的机器翻译（http://support.microsoft.com/kb/306070），但是总觉得好像不太通达，难以让人理解！<br/>E文地址：http://support.microsoft.com/?scid=kb%3Ben-us%3B306070&amp;x=17&amp;y=10<br/>我翻译如下：<br/>在InternetExplorer中对Cookie数目的多少和cookie字节数的大小限制的处理<br/>概述：<br/>Microsoft Internet Explorer 符合 RFC 2109推荐的最低限制标准如下：<br/> 最多 300个 Cookie <br/> 每个Cookie 最多4096 字节（如通过字符大小来计算没有限定对Set-Cookie头的大小进行描述）&nbsp;&nbsp;<br/> 每个唯一主机或域名称最多支持20个Cookie <br/>注意: 这些要求最低限制符合 RFC 2109中, 节 6.3, &quot; 实现限制 &quot;。 有关详细信息, 请参阅 &quot; 参考 &quot; 部分。<br/><br/>名称 - 每个Cookie对应一个名称--数值来配对， 这种名称和数值的陪对中间可由零或更多的属性由分号来分隔。 对于一个域名,每个Cookie 仅限于4,096 字节。 这个总数可存在作为一个名称 - 值对的 4(KB) 或作为最多 20 名称和数值配对总其不大于4KB。如果计算机没有足够空间来存储 Cookie, 会丢弃Cookie，同时将不能恢复。 因此使用Cookie的应用程序使用尽可能用少用Cookie 尽可能把所有的cookie的值写得尽可能的短小。否则, 应用程序不能读取到丢失了由于超过4Kb的cookie数值。<br/>如果一个Web 应用程序使用多达19个自定义的Cookie, ASP会话状态就很有可能丢失。 因为Internet Explorer 4.0 和更版本对于每个域允许总共才20 Cookie。是由于浏览器对如果使用 20个或更多的自定义Cookie时,浏览器将强制删除ASP前面的会话Cookie 从面导致会话丢失。 <br/><br/>要想存对于一个域存取多于20 多个cookie的名称和数值,你最好创建一个cookie字典(个人理解：相当于通过数组来达到增加cookie数目)通过级联各个名字对各个cookie但同时最好最高不能超出4096 字节的限制.目前做法是用来检索这些值来自客户端脚本, 您必须手动分析 Cookie值。然而,ASP请求和 响应对象包括内置功能使用 Cookie 词典作为词对象。 <br/>下列代码例子演示使用 ASP 页中 Cookie 词典： <br/>&lt;%<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;a&quot;)=&quot;A&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;b&quot;)=&quot;B&quot;&nbsp;&nbsp; <br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;c&quot;)=&quot;C&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;d&quot;)=&quot;D&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;e&quot;)=&quot;E&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;f&quot;)=&quot;F&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;g&quot;)=&quot;G&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;h&quot;)=&quot;H&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;i&quot;)=&quot;I&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;j&quot;)=&quot;J&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;k&quot;)=&quot;K&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;l&quot;)=&quot;L&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;a1&quot;)=&quot;A&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;b1&quot;)=&quot;B&quot;&nbsp;&nbsp; <br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;c1&quot;)=&quot;C&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;d1&quot;)=&quot;D&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;e1&quot;)=&quot;E&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;f1&quot;)=&quot;F&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;g1&quot;)=&quot;G&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;h1&quot;)=&quot;H&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;i1&quot;)=&quot;I&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;j1&quot;)=&quot;J&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;k1&quot;)=&quot;K&quot;<br/>&nbsp;&nbsp; Response.Cookies (&quot;MyCookie&quot;)(&quot;l1&quot;)=&quot;L&quot;&nbsp;&nbsp;<br/>&nbsp;&nbsp; Response.Cookies(&quot;MyCookie&quot;).Expires = &quot;12/31/2001&quot;<br/>&nbsp;&nbsp; For Each strKey In Request.Cookies<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write strKey &amp; &quot; = &quot; &amp; Request.Cookies(strKey) &amp; &quot;&lt;BR&gt;&lt;BR&gt;&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If Request.Cookies(strKey).HasKeys Then<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;For Each strSubKey In Request.Cookies(strKey)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Response.Write &quot;-&gt;&quot; &amp; strKey &amp; &quot;(&quot; &amp; strSubKey &amp; &quot;) = &quot; &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Request.Cookies(strKey)(strSubKey) &amp; &quot;&lt;BR&gt;&quot;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Next<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;End If<br/>&nbsp;&nbsp;&nbsp;&nbsp;Next<br/>%&gt;<br/>注意:<br/>对于Internet Explorer 5.0 和更高版本, 可用于 userData 行为跨会话保持数据通过seesions。这样做相比于Cookie的大小来说就会有更大容量来存取会话。 <br/><br/>如果使用 document.cookie属性在客户端可检索该 Cookie值, document.cookie 属性可检索只有4,096字节大小。 这个字节总数是 4KB, 这些字节总大小为 4KB的cooke是一个名称对应一个值最多可以有20个名称和值一一对应！<br/><br/>在 Microsoft HTML document.getcookie 函数调用 CDocument::GetCookie 方法。 <br/>
]]>
</description>
</item><item>
<link>http://www.jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [原创]在InternetExplorer中对Cookie数目的多少和cookie字节数的大小限制的处理（翻译自微软英文文档）]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>