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 7 2323
You would want to increment an application variable. You can decrease
this value in the seesion-end event.
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**********@freemail.it> wrote in message
news:9f**************************@news.microsoft.c om... 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
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
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**********@freemail.it> wrote in message
news:9f**************************@news.microsoft.c om... 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
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
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**********@freemail.it> wrote in message
news:9f**************************@news.microsoft.c om... 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
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**********@freemail.it> wrote in message
news:9f**************************@news.microsoft.c om... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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....
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |