Link to home
Start Free TrialLog in
Avatar of Starr Duskk
Starr DuskkFlag for United States of America

asked on

asp.net suggestions for session vs. database

I want to know the best performance for this scenario:

I have one page. On that page is the logged in user's client logo.
I could go to the user's client table and retrieve the logo from the database every time I hit the page.
Or I could save in a session the string for the logo when the user logs in.

Which is better on the system:
hitting the database to do this only when on that page.
vs. storing a session that will retain the value when visiting every page on the site, even though only needed on that one page.
or option C?

thanks!
Avatar of kaufmed
kaufmed
Flag of United States of America image

How big are the files?
Avatar of Starr Duskk

ASKER

I wouldn't be storing the file. I'd be storing the ID of the file and hitting the database to retrieve the file, but wouldn't have to hit the database to look up the id for the client. I never thought about storing the file itself in a session.

1. look up employee
2. find their clientID
3. go to the client table
4. find the client setup table
5. look up if they have an image uploaded for the logo
6 get the imageID
7 store the id in a session.
8 when I need to display the logo, use the id and pull it from the image table and display it.

That was my intended plan with the session. As opposed to just taking those 8 steps every single time I hit that page. so I'd just be storing a number in the session, not the image.

should I store the image? It would be a transparent png. can't say how big it would be. might vary.
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks!