cookie中的值超过4000字节? [英] Value in cookie more than 4000 bytes?

查看:106
本文介绍了cookie中的值超过4000字节?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我想在带有cookie的网页之间传递数据。但是cookie的最大容量差不多是4000字节。

但是我的数据超过了这个限制,我不知道data的确切大小。不时会有所不同。 />
我该如何解决?

我也不能使用会话。

先谢谢你。

Hi I want to pass data between webpages with cookie. But the max capacity for cookie is almost 4000 bytes.
However my data is more than that limitation, and i do not know the exact size of data.it can be different from time to time.
How can i solve it?
Also i can not use session.
Thanks in advanced.

推荐答案

我建​​议使用数据库。只需将id传递给其他页面可以查找的一些记录。



或者,如aspnet所提到的,使用多个cookie但是有这么多数据我会建议坚持到一个数据库,只传递ID。
I would recommend using a database. Just pass the id to some records that the other page can then look up.

Or, as aspnet mentioned, use multiple cookies but with this much data I would suggest sticking to a db and passing just the ID.


是的ryanb是对的,你想根据id搜索什么数据,或者如果数据大小是多少则使用多个cookie超过4000个字节。
Yes ryanb is right, what is the data you want to get search according to id or else use the multiple cookies if the size of the data is more then 4000 bytes.


编程是一个解决问题的活动。你不能打破尺寸限制,所以你必须解决它,没有特别的顺序你可以:





  • 尝试压缩数据
  • 将数据拆分到多个cookie中,您需要定义完成此操作的顺序(aspnet -i的想法)
  • 存储反对密钥的后备存储(例如数据库)中的数据,并在cookie中发送密钥(ryan的想法)
Programming is a problem solving activity. You can't break the size limit, so you have to work around it, in no particular order you could:


  • Try compressing the data
  • Split the data across several cookies, you'll need to define the order you have done this in (aspnet -i's idea)
  • Store the data in a backing store (such as a DB) against a key, and send the key in the cookie (ryan's idea)


这篇关于cookie中的值超过4000字节?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆