I'm working with an asp.net application that stores most data in a database and not session. I'm wondering of the pros and cons of each and which is the better way to go. For example, you have a pretty busy site and instead of storing user specific variables in session, there is a DB table called user data and it can store all user specific data that can be accessed from any page by querying the database. Which is the better way to go, session or database?
Things like Database Data such as User Rows should not be stored in the session and you should create a separate cache mechanism to do this for you.
application variable creates only one memory for one variable and for all user . while session creates one memory for one variable for one user :) Application variable will be maintained like global variable. Ex if I create a application session in my project and assign this value 1.
No, it is not shared.
no, stored on server somewhere in tmp folder. sessions are serverside, cookies are client side. Cookies are the default method of tying a user's session id to the session data on the server.
Session (but it depends a lot of the session configuration) :
Database :
Please note that you can store Session information in database. That's why I use the word "may" in the Session part. See here some session configuration and possibilities
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With