How many session variables is safe.

davidrobin

Freshman
Joined
Jun 24, 2003
Messages
41
Is there any safe number of session variables to have.
I have 6 and they are small strings, no objects.

I was thinking of storing the database connection object in a session variable but then you get into all sorts of checks depending on which page the user happens to start their navigating at.
 
Robby said:
Why not store the connection string in a class or in the web.config.

I keep switching between the two options for the connection string, what I am thinking is I could store the actual connection object in a session variable then I can keep the same connection without having to open a new connection on each page.
As I understand it, with storing it in a session object the connection will not close until the session ends. This could mean a number of redundant connections could be lying around.

Instead of 6 session objects I could have my data in a class and put the class in a session object then the data is persisting.
 
Back
Top