Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cache or Session? (or other) 2

Status
Not open for further replies.

jubble

Programmer
Mar 6, 2002
207
GB
Where is the best place to store a user's id and connection string for use between pages, the Cache or the Session object?

I'm led to believe that the Cache can be wiped at any time if the memory on the Server is fading...is this correct?

I don't want to use query string for the user id as the query string wouldn't be able to hold the connection string and it wouldn't make much sense to have one storage method for user id and a different storage method for connection string.
 
Connection string information should be kept in the web.config file. As for the user information, I would use session variables.
 
if you need to store both for each user, you would probably want to create a class object of User then have all details you want in that object...

Code:
Dim user as New User()
user.ID = "445"
user.Name = "Name"
session("userInfo") = user

Then to call it later...
Code:
dim user as new User()
user = Ctype(Session("userInfo"),User)

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top