You meant the session id? (as when the user login the session should have basically no data). You could store that in a global dictionary.
I would suggest rather to tell what is the final goal (what do you do when a session ends, if this is to have an approached value of the number of online users you likely have better way to do so).
Member
21 Points
151 Posts
store number of sessions per user
Mar 24, 2015 06:40 AM|Sanfoor|LINK
i have a web application. i need for every time the user login to the system to store the opened session for this user in a dictionary.
any help?
asp.netc# session
All-Star
48570 Points
18086 Posts
Re: store number of sessions per user
Mar 24, 2015 07:54 AM|PatriceSc|LINK
Hi,
You meant the session id? (as when the user login the session should have basically no data). You could store that in a global dictionary.
I would suggest rather to tell what is the final goal (what do you do when a session ends, if this is to have an approached value of the number of online users you likely have better way to do so).
asp.netc# session
Contributor
6495 Points
1163 Posts
Re: store number of sessions per user
Mar 24, 2015 09:52 PM|Summer - MSFT|LINK
Hi Sanfoor,
Thank you for your post.
Based on my understanding, I think you could first retrieve the sesstion from SessionStateItemCollection according to the link below.
https://msdn.microsoft.com/en-us/library/ms178581(v=vs.140).aspx
And then add them to Dictionnary.
Regards & Summer
asp.netc# session