Member_2_5230414
asked on
Vb - Count users on page
Hey guys,
Im creating a forum in vb (visual studio) and want to know how i can get no of users on the page.
I know you can use Membership.GetNumberOfUser sOnline() to get users online but i want to find how many are viewing a page.
Im creating a forum in vb (visual studio) and want to know how i can get no of users on the page.
I know you can use Membership.GetNumberOfUser
ASKER
Sounds like a very coplex way about it... as u see on my other question i have been able to record views and delete them on other pages but the whole browser closing is the issue.
It must be done as i have seen it used in other places and i know php can do it very well
It must be done as i have seen it used in other places and i know php can do it very well
ASKER
my other option is on every page to record the page the user visited last and at what time... then run a query of the page from the last 10 seconds and make anote of that
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
One mechanism you can consider is to generate a serial number (maybe using a GUID string), then have a Javascript that polls the server every few seconds (say every 3 seconds) and all that it does is to send back that same GUID to the server. On the server, you can perhaps have a DataTable in which you store the GUID and the last time you "heard" from that GUID... You can regularly clear out (from the datatable) any GUID values that havent "spoken" to the server in say 10 seconds... A count of the number of rows in that DataTable then becomes the number of people still on the page (relatively accurate within the last 4-6 seconds). It is very imprecise, but might do the trick...
This mechanism is also not without problems, for the number of connections that it opens and closes every so often with the server. Have a look at this (for other technical considerations) http://query7.com/avoiding-long-polling
The jQuery snippet below polls the server every 3 seconds for new information and displays it in a simple alert box.
Open in new window