简体   繁体   中英

How to check in ASP.NET if the user is online?

what is the logic behind this on this website "last activity: 1 min ago from this ip address " If you are obtaining the user's IP address in a hidden field , how can I do this in vb.net ?

And how can I check how many users are online using the application ?

The ASP.NET Membership service supports this feature. To get the particular user's last activity date, use LastActivityDate property and to indicate whether the user is online or not use IsOnline property. Also to get the number of online users, use GetNumberOfOnlineUsers . Of course, the ASP.NET Membership service does not save the last IP address, and you have to override some behavior of SqlMembershipProvider in this case.

Each ASP.net page has a Session with you can use to check if your useris online or not for example

   Session["IsOnline"] = "true";

then whenever user do not act with page (Asp.net engine) start to count +++++++

and when the count became more than what you specify in the Web.Config the session will Expire . And When Session Expiered your user is offline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM