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 use开发者_开发知识库r'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.
for counting the online users see below links :
http://aspnetresources.com/blog/count_your_visitors.aspx
http://www.codeproject.com/KB/aspnet/Online-Active-Users.aspx
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.
精彩评论