Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...