hello guys how r u ?
my question is that, how we can create session in global.asax for the whole application in asp.net using c# ?
Reply Soon
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jean PaulPosted Nov 2, 2011, 4:29 AM
The sessions are per user basis. The session of one user should not interfere with another user's session.
I believe your purpose is to share some object throughout the entire application. If this is the case you ca use the following methods.
1) Use Cache object with is thread safe. The object stored on Cache will be visible to all the users. So inside the Global.asax you can create the object and place in the Cache. It contains the key, value and expiry properties
Eg: Cache.Insert("key", "value")
2) Use Application object
Eg: Application["key"] = "value";
3) Use a static property
Regards,
Jean Paul