Adam wrote:
Well guys some might consider this a silly topic but i just want to get
the general consensus on the matter.
So i ask the question "Which is more efficient to use Cookies or
SessionState Variables ?".
I'm just looking for opinions so please don’t flame me.
- Adam
Depends on how you want to use them:
Cookies:
- browser sends them on every request: you don't want too much data there
- are stored on the user's computer
- pro: no timeout (if you want)
- con: user can read and/or delete them
- needs serializing to string
Session:
- Stored on the server (by default in-memory, other options exist)
- You can use larger structures (but don't overdo it)
- you can store references to classes, no need to serialize (if InProc)
- times out after a while (20 minutes by default)
- users can't access/modify them
--
Hans Kesting