473,549 Members | 3,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Track the users on line?

Which is the best way to track the number of the user currently logged into
a web site?
I've some idea on mind, but I want to compare with you.

One could be to increment a session variable on the session_start in the
global.asa.

But what for decrement the value? This is a black ole, that independently
of all, I don't know
how to solve.

Thank you
Andrea

Mar 17 '06 #1
7 2329
You would want to increment an application variable. You can decrease
this value in the seesion-end event.

Mar 17 '06 #2
Jacob is right but keep in mind that this will not be 100% accurate.
There will be lag time between when a person closes their browser and when
the session times out. During that time the person could even log back in
and therefore be counted multiple times for a while.
There are also some circumstances in which Session_End may not fire.

A somewhat more accurate way would be to count logins - if you have an
authentication system in place.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"andrea" <go**********@f reemail.it> wrote in message
news:9f******** *************** ***@news.micros oft.com...
Which is the best way to track the number of the user currently logged
into a web site?
I've some idea on mind, but I want to compare with you.

One could be to increment a session variable on the session_start in the
global.asa.

But what for decrement the value? This is a black ole, that independently
of all, I don't know
how to solve.

Thank you
Andrea

Mar 17 '06 #3
But it's the same. Suppose I update a table on db that track if user is logged
in, if session_onend
doesn't fire regularly I cannot update back the table.
The solution I used in the past, in this circustamces is deny user login
for the next 20 minutes from
the last login date. And for every user log in launch a general SQL update
query that set to log off
all user that match the above criteria.

I was wondering that new asp.net new system without all this tricks.

Bye
Andrea

Mar 17 '06 #4
re:
The solution I used in the past, in this circustamces is deny user login for the next 20 minutes
from the last login date.
That doesn't work.
Users could, very easily, have valid sessions way past the 20 minute timeout.

Every time a user requests a page, any page,
the clock is reset to the default value set in session timeout.

What you need to look for is for periods of 20 minutes
occurring after the last page is requested by the user.

*Then* you can subtract one from the online user count.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"andrea" <go**********@f reemail.it> wrote in message
news:9f******** *************** ***@news.micros oft.com... But it's the same. Suppose I update a table on db that track if user is logged in, if
session_onend doesn't fire regularly I cannot update back the table.
The solution I used in the past, in this circustamces is deny user login for the next 20 minutes
from
the last login date. And for every user log in launch a general SQL update query that set to log
off
all user that match the above criteria.

I was wondering that new asp.net new system without all this tricks.

Bye
Andrea

Mar 17 '06 #5
But doesn't the session close the channel when the user close the browser?
Isn't the same if user change site? So I suppose that simply entering a valid
URI
into the address bar, shouldn't open a new session.

But what I mean is - in this case - a session track for user that has been
authenticated.

So.

A valid url, or homepage, add +1 to the global counter ... that's fine ...
and impossible
to trap.
A user login, update table flag to know that user has logged into the system.
If he try again to log from a new browser, the check for the flag doesn't
allow the access.
If a browser will close without pass for the appropriate log off button,
the flag remain there
since lastlogin field on the db + 20 minutes doesn't allow the next user
who try the login to
update all users flag to not logged.
This is system I've used. And always works. But not solved the spot user
that isn't logged in.
For that the best way - I think - is simply doesn't care.

What do you do generally?

Bye
Andrea

Mar 17 '06 #6
the web is stateless. when the brpowser requests a page,

1) opens a socket to the webserver
2) writes the request to the srever
3) reads the response
4) closes the socket.

if keep alives are on, a timer is set to close the socket after a very short
timeout. if a new request comes up in that time period the socket can be
reused.. keep alive generally is used to fetch the page's media without
extra open/close operations, not to keep socket open between requests.

-- bruce (sqlwork.com)

"andrea" <go**********@f reemail.it> wrote in message
news:9f******** *************** ***@news.micros oft.com...
But doesn't the session close the channel when the user close the browser?
Isn't the same if user change site? So I suppose that simply entering a
valid URI
into the address bar, shouldn't open a new session.

But what I mean is - in this case - a session track for user that has been
authenticated.

So.
A valid url, or homepage, add +1 to the global counter ... that's fine ...
and impossible
to trap. A user login, update table flag to know that user has logged into
the system.
If he try again to log from a new browser, the check for the flag doesn't
allow the access.
If a browser will close without pass for the appropriate log off button,
the flag remain there
since lastlogin field on the db + 20 minutes doesn't allow the next user
who try the login to
update all users flag to not logged.
This is system I've used. And always works. But not solved the spot user
that isn't logged in.
For that the best way - I think - is simply doesn't care.

What do you do generally?

Bye
Andrea

Mar 17 '06 #7
re:
But doesn't the session close the channel when the user close the browser?
No. It closes the session after the number of minutes specified in web.config
for the sessionstate's timeout value has expired and the user hasn't requested
a page in at least that time.

re: So.
So, your premise is mistaken, so your method can't work.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"andrea" <go**********@f reemail.it> wrote in message
news:9f******** *************** ***@news.micros oft.com... But doesn't the session close the channel when the user close the browser?
Isn't the same if user change site? So I suppose that simply entering a valid URI
into the address bar, shouldn't open a new session.

But what I mean is - in this case - a session track for user that has been authenticated.

So.
A valid url, or homepage, add +1 to the global counter ... that's fine ... and impossible
to trap. A user login, update table flag to know that user has logged into the system.
If he try again to log from a new browser, the check for the flag doesn't allow the access.
If a browser will close without pass for the appropriate log off button, the flag remain there
since lastlogin field on the db + 20 minutes doesn't allow the next user who try the login to
update all users flag to not logged.
This is system I've used. And always works. But not solved the spot user that isn't logged in.
For that the best way - I think - is simply doesn't care.

What do you do generally?

Bye
Andrea

Mar 17 '06 #8

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

Similar topics

8
2376
by: Brent | last post by:
Does anyone know the best way to detect and track a visitors screen resolution. I know the javascript to detect the users resolution but I am a bit confused on the best way to track and save this. Should I save it to a database or is it easier to save it to a text file?
2
3070
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing this by aggregating new content from all databases into a single indexed database and then saving a timestamp in the account database (for the...
1
2782
by: Gaurav | last post by:
Hi, is there a way to know which user last logged in the shared Access database. My requirement is that I must be able to track the users that log in the database and incase its not working because one of the user has done something wrong that I must be able to track him/her. TIA -G.
2
303
by: Menno Abbink | last post by:
I'm writing a simple asp.net (with vb.net) guestbook application. I wan't the users to be able to insert a emoticon in there message by clicking on the emoticon of there choice. After clicking on the emoticon a little piece of text will be added to there message (e.g. :smile:) at the exact location where the cursor was before they clicked the...
1
1446
by: shank | last post by:
Imagine a CD of say 20 songs Each song is a table row I need a way for the user to change the way the songs are listed by allowing them to change the track numbers. What is the smartest way to do this? I think it would be kind of trick to have a couple of <IMG> up and down arrows per each song. The user would click on either the up or...
3
4402
by: johnny | last post by:
hi all! I am starting to study the best way to track site visitors. Logfiles stats which come with every web hosting, have little metrics to be analyzed and also problems with cached pages which are not seen. I thought to use php and cookies to track returning visitors, however I see that all pro solutions use javascript to set cookies....
15
6693
by: l3vi | last post by:
I have a new system Im building that stores entries of what people are searching for on my sites. I want to be able to keep records of how many times a keyword was searched for daily, and from that I can calculate weekly and monthly. At this point I have one entry per search phrase with the number of hits the search phrase has gotten, and...
6
1646
by: trungthanh78 | last post by:
Hello everyone, I'm totally new to the group and I would like to learn from you. Thank you in advance! I need to write a program to track whether a mathematical function has changed during run-time or not. The program should work with any mathematical function provided by users. Let's take an example in the C language:
3
4170
by: dirksza2009 | last post by:
Hi, I've made a multi user (4 end users) database in Access 2000. I've made data tables, reference tables etc which sits on a shared drive and I've made individual front ends for the end users which gives them specific views of the data. I'd like to track all the changes made to a record which works find with the following code : ...
0
7520
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.