nzinsli
asked on
Cookies: Key/Value pairs vs separate cookies
Can anyone tell me what the pros/cons are of using a single cookie with multiple key/value pairs vs using multiple cookies with a single value? I'm wondering if there are performance benefits or issues, or other programming pros/cons for one or the other.
I don't think there's a performance difference. The only issue I can think of is keeping track of the different names.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is the 4k limit per cookie, or as a total for all cookies for the domain?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
Is there any real performance concerns in .Net with the code needed to retrieve a cookie value vs parsing the key/value pairs?
Is there any real performance concerns in .Net with the code needed to retrieve a cookie value vs parsing the key/value pairs?
Retrieving a cookie requires a round trip to the client. That's subject to the vagarities of the network. Parsing key/values will be done as fast as the local machine can make it happen.
> Retrieving a cookie requires a round trip to the client. That's subject to the vagarities of the network. Parsing key/values will be done as fast as the local machine can make it happen.
@paulmacd
It does not work that way. The cookies are posted to the server along the request by the client and are parsed on the server.
"When a browser makes a request to the server, it sends the cookies for that server along with the request."
http://msdn.microsoft.com/en-us/library/aa289495%28v=vs.71%29.aspx#vbtchaspnetcookies101anchor8
@paulmacd
It does not work that way. The cookies are posted to the server along the request by the client and are parsed on the server.
"When a browser makes a request to the server, it sends the cookies for that server along with the request."
http://msdn.microsoft.com/en-us/library/aa289495%28v=vs.71%29.aspx#vbtchaspnetcookies101anchor8
Hey, I learned something!
In any case, having fewer cookies means less overhead.
In any case, having fewer cookies means less overhead.
ASKER
Thanks!