Last post Jan 11, 2017 10:21 PM by mtugnoli
Jan 11, 2017 02:58 PM|mtugnoli|LINK
No-one have answare me ...
How Get logged in users list (online users) in Asp.Net Core 1 ?
Before with asp.net mvc 4.x, I used Session events, and now ?
Jan 11, 2017 03:18 PM|Dmitry Sikorsky|LINK
I think you can add some static collection to your Startup class and add user there when he is logged in and remove it when the user is logged out. (I think you have controller actions for that.) Very simple solution.
Jan 11, 2017 10:16 PM|mtugnoli|LINK
The problem is when user close the browser without logoff.
I would like to count the "sessions"
es. if 2 users login with same username I have to count 2 not 1
Jan 11, 2017 10:20 PM|Dmitry Sikorsky|LINK
In this case you could write something in the cookies and have your local static dictionary where the key is something written to the cookies and the value is timestamp of the last access. I think it is 100% working solution, but maybe not so elegant like
something build in. But I don't remember anything done matching your need. So when user access your app you check his cookies and if found the value check the last access time. If cookie is not found you set one and add to the dictionary. Also you need to
go through you dictionary every request (or using timer) and remove all old entries.
Jan 11, 2017 10:21 PM|mtugnoli|LINK
I try this solution, thank you for help