Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing open sessions on my server

Status
Not open for further replies.

markSaunders

Programmer
Jun 23, 2000
196
GB
Is it there any way to list all the (username) session parameters that are currently open on the server.

We have a client that wants to list on an asp page what user's are currently logged in (or at least havent had their session reset after the standard 20 mins).

The users login on a standard type page that creates their session("userName") paramater - the client wants to know who is looking at the site.

Cheers
m Mark Saunders :)
 
Hi Mark,

Unfortunately, there is no way of listing or obtaining all the different session values. What you may want to do is either add the username of each person that logs on into an Application variable.

When the user's session times out, just clear that name from the variable.

Simple ain't it? heh..

Hope this helped.

Gorkem.
 
Was worried that was the only way - cheers for the advice!
m Mark Saunders :)
 
the only question left then is how do i access the individual session that has just ended?

for example
Liz logs in, Mark logs in, Joe logs in.

In the application i record 3 users using the on session start logins = logins + 1

i can also add to the application varaible the name as users log in, so at this point it would equal "Liz, Mark, Joe"

On session end i can easily reduce the logins using login = login - 1 but how do i access who has ended their session and thus remove their name from the list?

cheers
m
Mark Saunders :)
 
This may get a little complicated but here goes...

To Start.. do this in the global.asa file

under Application_OnStart

Application("OnlineUsers") = ""

...
Under the login page.. When a user logs in.. you need to capture the username in both a session variable and Application variable..

Session("UserName") = username
Application("OnlineUsers") = Application("OnlineUsers") & username & ","

....
Then under global.asa again..

under Session_OnEnd

Application("OnlineUsers") = replace(Application("OnlineUsers"),username & ",","")
Session.Abandon

...
Thats it.. easy enough right?

Let me know how this works out for you..

Cheers,

Gorkem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top