I'm trying to track how many users are visiting a site and how may are
logged in, using application sessions like so:
Sub Session_OnStart
Session.Timeout = 20
Session("Start" ) = Now
Application.Loc k
Application("Ac tiveUsers") = Application("Ac tiveUsers") + 1
Application.UnL ock
End Sub
Sub Session_OnEnd
Application.Loc k
Application("Ac tiveUsers") = Application("Ac tiveUsers") - 1
Application.UnL ock
End Sub
The problem is that I don't know whose session is ending, a logged in user
or a visitor and therefore can't decrement when one or the others session
ends.
Is it possible to identify the session that is ending by name so I can track
two different sets of data, one for visitors and one for users? What is a
good way to go about this consdering that users won't always click the
"logout" button when ending their visit?
Thank you 8 1682
How about :
Sub Session_OnStart ()
Application.Loc k
Application("To talUsers") = Application("To talUsers") + 1
Application.Unl ock
End Sub
Sub Session_OnEnd()
Application.Loc k
If Session("Userna me") = "" Then
Application("Vi sitors") = Application("Vi sitors") - 1
Else
Application("Re gisteredUsers") = Application("Re gisteredUsers") - 1
End If
Application.Unl ock
End Sub
And in your login code,
<%
'''code for login
Application.Loc k
Application("Re gisteredUsers") = Application("Re gisteredUsers") + 1
%>
Ray at work
"gil" <gi*@nospam.tha nkyou> wrote in message
news:uS******** ******@TK2MSFTN GP10.phx.gbl... I'm trying to track how many users are visiting a site and how may are logged in, using application sessions like so:
Sub Session_OnStart Session.Timeout = 20 Session("Start" ) = Now Application.Loc k Application("Ac tiveUsers") = Application("Ac tiveUsers") + 1 Application.UnL ock End Sub
Sub Session_OnEnd Application.Loc k Application("Ac tiveUsers") = Application("Ac tiveUsers") - 1 Application.UnL ock End Sub
The problem is that I don't know whose session is ending, a logged in user or a visitor and therefore can't decrement when one or the others session ends.
Is it possible to identify the session that is ending by name so I can track two different sets of data, one for visitors and one for users? What is a good way to go about this consdering that users won't always click the "logout" button when ending their visit?
Thank you
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. How about:
Sub Session_OnStart () Application.Loc k Application("To talUsers") = Application("To talUsers") + 1 Application.Unl ock End Sub
Sub Session_OnEnd() Application.Loc k If Session("Userna me") = "" Then Application("Vi sitors") = Application("Vi sitors") - 1 Else Application("Re gisteredUsers") = Application("Re gisteredUsers") - 1 End If Application.Unl ock End Sub
And in your login code,
<% '''code for login Application.Loc k Application("Re gisteredUsers") = Application("Re gisteredUsers") + 1 %>
Ray at work
Ray,
on a similar theme I'd like to check for the existance of someone being
logged on. I posted a day or so ago and had a reply from Tom, and I've
looked at the FAQ but the global.asa and application stuff is new to me and
so this might be a little beyond my scope.
I'm trying to see if someone is logged on by checking to see if a session
exisits in their name, how would I go about this?
many thanks
Write the info to a database when they logon.
"Alistair" <ma**@alistairb removeme.co.uk> wrote in message
news:10******** ****@corp.super news.com... "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in message news:%2******** ********@TK2MSF TNGP14.phx.gbl. .. How about:
Sub Session_OnStart () Application.Loc k Application("To talUsers") = Application("To talUsers") + 1 Application.Unl ock End Sub
Sub Session_OnEnd() Application.Loc k If Session("Userna me") = "" Then Application("Vi sitors") = Application("Vi sitors") - 1 Else Application("Re gisteredUsers") = Application("Re gisteredUsers") -
1 End If Application.Unl ock End Sub
And in your login code,
<% '''code for login Application.Loc k Application("Re gisteredUsers") = Application("Re gisteredUsers") + 1 %>
Ray at work
Ray,
on a similar theme I'd like to check for the existance of someone being logged on. I posted a day or so ago and had a reply from Tom, and I've looked at the FAQ but the global.asa and application stuff is new to me
and so this might be a little beyond my scope.
I'm trying to see if someone is logged on by checking to see if a session exisits in their name, how would I go about this?
many thanks
<je**@removeeme rgencyreporting .com> wrote in message
news:u3******** ******@TK2MSFTN GP11.phx.gbl... Write the info to a database when they logon.
yes I thought of this but most users don't logout, they just close the
browser and so the DB record would not get removed.
No, you remove the record when they log in again..typical setup
Jeff
"Alistair" <ma**@alistairb removeme.co.uk> wrote in message
news:10******** *****@corp.supe rnews.com... <je**@removeeme rgencyreporting .com> wrote in message news:u3******** ******@TK2MSFTN GP11.phx.gbl... Write the info to a database when they logon.
yes I thought of this but most users don't logout, they just close the browser and so the DB record would not get removed.
<je**@removeeme rgencyreporting .com> wrote in message
news:u1******** ******@TK2MSFTN GP09.phx.gbl... No, you remove the record when they log in again..typical setup
Jeff "Alistair" <ma**@alistairb removeme.co.uk> wrote in message news:10******** *****@corp.supe rnews.com... <je**@removeeme rgencyreporting .com> wrote in message news:u3******** ******@TK2MSFTN GP11.phx.gbl... > Write the info to a database when they logon. >
yes I thought of this but most users don't logout, they just close the browser and so the DB record would not get removed.
and how is that going to show when they are logged in??
when they log in the first time, I write a record in the DB that shows they
are logged in, then they close the browser, and if they don't log in for
another week then the record showing them as logged in is wrong for a week!!
Alistair wrote: and how is that going to show when they are logged in??
when they log in the first time, I write a record in the DB that shows they are logged in, then they close the browser, and if they don't log in for another week then the record showing them as logged in is wrong for a week!!
That's the nature of the beast. Aaron describes a strategy for deleting
inactive users in an article at www.aspfaq.com, but even that is not
perfect. You have to realize that with a stateless protocol like http, there
is no way to know for certain how many users are logged in.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Exactly. With HTTP, there is NO guaranteed way to determine log out.
You can always implement logic that concludes that if a user has a login
record, but hasn't hit the database for an hour (or whatever), then they are
gone. Obviously this would imply that you would have to log every page hit
in the database.
Jeff
"Alistair" <ma**@alistairb removeme.co.uk> wrote in message
news:10******** *****@corp.supe rnews.com... <je**@removeeme rgencyreporting .com> wrote in message news:u1******** ******@TK2MSFTN GP09.phx.gbl... No, you remove the record when they log in again..typical setup
Jeff "Alistair" <ma**@alistairb removeme.co.uk> wrote in message news:10******** *****@corp.supe rnews.com... <je**@removeeme rgencyreporting .com> wrote in message news:u3******** ******@TK2MSFTN GP11.phx.gbl... > Write the info to a database when they logon. >
yes I thought of this but most users don't logout, they just close the browser and so the DB record would not get removed.
and how is that going to show when they are logged in??
when they log in the first time, I write a record in the DB that shows
they are logged in, then they close the browser, and if they don't log in for another week then the record showing them as logged in is wrong for a
week!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: marslee |
last post by:
I want to prevent non-registered users to view a page in my website,
For example, when a non-registered user clicks the history page, the
website site refuses to go there since he is not registered.
what is the best way to do it? And how to identify a user has already
logged in when he click the history page?
|
by: hawkon |
last post by:
Hi all,
I have an important question to ask about how to trap events when the user
close the browser window.
I'm a ASP programmer and I have s MSSQL database with a user table where I'm able to track if the user is logged in or not.
However this is not easy to track if the user close the browserwindow without using the logout button. I have tried putting in code in Session_onend, but it doesn't seem to run if the browser is closed. Eg....
|
by: Robert Oschler |
last post by:
This is my current strategy for tracking hyperlink clicking by a site
visitor (Internet Explorer example):
Using Javascript I:
Attach an event to the document "onclick" handler.
When a click occurs, the Javascript "onclick" event hander I assigned,
checks to see if the event srcElement (or its parent in the case of a "font"
element) is a hyperlink (tagName = "A" or "a").
If so, I build a URL with the search arguments set to the...
|
by: steves |
last post by:
Hello,
We are developing a web application written in classic ASP, which will
end up running on Windows 2000 server.
The site has a public side (the login page and related images), and a
private side (a series of ASP scripts which check session variables to
make sure the current user has logged in before delivering their
content).
|
by: MUHAMAMD SALIM SHAHZAD |
last post by:
dear respected gurus,
I would like to share ideas...as i learned from you and wish to tell
that i had developed the system where i can audit each and every users
and their actions(like add/edit/save/cancel/unco)
=======================start of
modules=======================================
Option Compare Database
Option Explicit
| |
by: Nel |
last post by:
I have a web site that seems to be getting hammered by lots of bots.
Some genuine, some questionable. Some just users that seem to be
downloading the site en-masse. I have started using php & mysql to track
the IP, host, browser, proxy of all visitors and am trying to gauge how many
pages to serve within one hour before restricting access.
What do you consider to be a reasonable number of visits per hour? Do many
bots rush through a...
|
by: runner7 |
last post by:
Can anyone tell me if there is a way in PHP to determine when a session
times out on the server or how many concurrent sessions there are in
your application?
|
by: C# programmer |
last post by:
Hi All,
I'm working on a project which requires tracking of recent document
downloads. There is a feature in which user can download the docs
without logining into the website for some of the clients. While for
other clients user has to log into the website to download docs.
We used to create dummy/fake accounts(in sql server) for client users
who do not require login and use the created account to track recent
downloads(using cookie...
|
by: sparks |
last post by:
At first they just wanted to keep a record of who logged in and when.
Then it was if they made changes.
Now its who changed what. BUT since this made no since to them.
WHO put it in and who changed it.
WTF are they talking about.
So every variable will have to be logged at entry and later IF someone
changes it it will have to be logged like from and to ...then by who
and when ???
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |