What is the alternative of Session variable in C#?
I want to keep logged in user for further use without using session. How can i do that? What's the best option?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Jan 17, 2015, 6:49 PM EST
Bhushan GawaleRank #299 · 8.4K reputationPosted Jan 17, 2015, 7:55 PM EST
- ViewState
- Hidden Fields
- Cookies
- Query Strings
It is highly recommended that - you should use the above mentioned for storing non sensitive and light weight data, because it is exposed in the client application (e.g. browser).Another server side state management technique is the use of application variables - but those cannot be used as alternative to session variables, as application variables are shared acros your users.
For your case - I guess you can rely on cookies but again - make sure you don't save anything sensitive in it.
Read more about usage of cookies here - http://asp.net-tutorials.com/state/cookies/