One large, or multiple small session variables

D

DrewM

I'm still thinking about session variables :)

Does anyone know the detail of how session variables are actually stored?
The question I'm trying to answer is:

Is it more efficient to store and retrieve multiple short strings :

a) in multiple small session variables
b) concatenated and stored as one large session variable
c) inserted into an array and stored in a session variable
d) it's all the same. Who cares?

Keeping in mind that for this application each piece of data will be
retrieved for every page.

I've read that storing a dictionary object in a session variable is bad
ews - something to do with ending up with thread in your apartment, or
something ;-)

What I'd really like to do is create an XML object and store that in a
session variable, but I'm guessing that would be pretty inefficient unless
it had quite a lot of data in it.

Any thoughts on the above appreciated.

Drew
 
P

Phillip Windell

DrewM said:
a) in multiple small session variables
b) concatenated and stored as one large session variable
c) inserted into an array and stored in a session variable
d) it's all the same. Who cares?

I lean towards "D", however you should keep that amount stored as
small as you can in any method. Remember that it creates a copy of the
data for every session and the session may hang around for 20 minutes
after the person left the site. So you can eat up a lot of memory.

You could use Application Variables and would then only have one copy
of the data, however every user gets the same values which may not be
what you want.
I've read that storing a dictionary object in a session variable is bad
ews - something to do with ending up with thread in your apartment, or
something ;-)

Yes, the thread in the apartment issue is bad, especially with small
animals around :-], but seriously,..yes you do not want to do that.


--

Phillip Windell [CCNA, MVP, MCP]
(e-mail address removed)
WAND-TV (ABC Affiliate)
www.wandtv.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,237
Latest member
AvivMNS

Latest Threads

Top