473,395 Members | 1,526 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to find total current users at site

Hi All,
We have a requirement to display total number of current users using the
site. We want to display only the total no other information. And this value
needs to change dynamically.

Is it possible to do this? Please let me know how to do it.

Thanks.
Jul 23 '05 #1
2 2384
have an application variable that gets incremented on session on start and
decremented on session on end. If you want it dynamic without a postback
you'll need to use something like ajax

http://weblogs.asp.net/mschwarz/arch...07/397504.aspx

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"msnews" <an******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All,
We have a requirement to display total number of current users using the
site. We want to display only the total no other information. And this
value
needs to change dynamically.

Is it possible to do this? Please let me know how to do it.

Thanks.

Jul 23 '05 #2
That's a difficult number to calculate. You could keep a counter of the
number of sessions, if you are using session state. However, if you have
more than a few users, session state may affect your overall scalability.

There are probably online companies that have set up this infrastructure.
You may want to look to them, and buy the service.

On the other hand, you could write code to count current users. Warning:
this solution is sub-optimal for high-traffic sites. If you have a
high-traffic site, I'd suggest using an HTTP Module to count hits. However,
for the average sites, this will do:

Set up your code to access a singleton where you keep a list of IP addresses
that have accessed your site, and the time of day the hit occurs. Create a
windows service that calls a page on your site once every second as well.
On every hit, see if the IP address is in the list. If not, add it and set
the time. If so, reset to the current time. Then, scan the list, dropping
every IP address that is older than X seconds (I'd suggest 300 seconds).

To display the current number: You can place a control on a page somewhere
that uses XMLHTTP to go back to the server, on a regular basis, and get the
current count from the list. That way, the number will change dynamically.
See Ajax.Net for a control that is already wired to do this.

Good luck

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"msnews" <an******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi All,
We have a requirement to display total number of current users using the
site. We want to display only the total no other information. And this
value
needs to change dynamically.

Is it possible to do this? Please let me know how to do it.

Thanks.

Jul 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
5
by: fwells11 | last post by:
Hi there. As you will see from my questions, I am an SQL newb. I dabble but never get to spend enough time to get proficient so base any feeedback on that basis please. This is all theoretical...
6
by: KS | last post by:
I have made a WebForm with log ON/OFF off users. There is a label that shows the total count off users logged on stored in Application("UserCount") It works fine if the users logs out WITH THE...
6
by: John Dalberg | last post by:
I want to automate the process of logging into an intranet. I want to pull out the username of the Windows user logged into the machine running the browser and use the username in my app. How can I...
2
by: msnews | last post by:
Hi All, We have a requirement to display total number of current users using the site. We want to display only the total no other information. And this value needs to change dynamically. Is it...
1
by: CaptainDahlin | last post by:
I know the basics about access reports and putting page totals in the page footers. What I can't figure out is along with the current page total to display the previous page total: At the bottom...
7
by: Kesavan | last post by:
Is there any way to run a function or a code-block whenever the client- server communication breaks off. (ie power-off, browser-crash...) Why I need this is, I want to update a login-table to...
2
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double)...
10
by: CodeNoob | last post by:
please help been working on a project got it down to 5 errors from 100 now i have no idea what to do. Errors: init: deps-jar: Created dir: C:\Users\Tommy\Desktop\build\classes Compiling 306...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.