Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Counting open sessions
Old 03-25-2005, 08:24 PM Counting open sessions
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi all,

My web site enables a login from the client.

When the client has successfully logged in, a session variable is set.

My ? is.

How do I get a count of these sessions variables and read each one so as i might be able to give each user a list of who is logged in.

cheers
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 03-26-2005, 07:51 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
I don't know if it's possible that way but what you could do is maintain a list of logged in users somewhere (text file, database, etc) i.e. add the name to the list on login, and remove it on logout. You can then just reference that list each time.
Alternatively, if you're using a database to store login details, add an extra field called 'LoggedIn' or something, make the type 'bit' (in SQL Server) or 'Yes/No' (in Access). then use something like SELECT * FROM Users WHERE LoggedIn = 1
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 03-26-2005, 05:34 PM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
HI ya,
Thanks for your input.
I did in fact think of doing that originally however my thoery failed when considered how I would tell that a user had logged out if they jsut simply close the window and dont log out in the proper manner. I wont be ablt to run any code, to remove his/her loggin status.

Do you have any ideas how i could over come this?

cheers
Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Old 03-27-2005, 09:05 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
Yup. Put the logout code also in global.asa - the file shoud look like this:

Code:
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
	Sub Application_OnStart
	End Sub

	Sub Application_OnEnd
	End Sub

	Sub Session_OnStart
	End Sub

	Sub Session_OnEnd
	    ' Logout code here
	End Sub
</SCRIPT>
Save it in the root of your application. It won't run as soon as the browser window closes, but the session will time out eventually - depending on what your session timeout is.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 03-27-2005, 03:13 PM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
wicked. thanks very much indeed.
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to Counting open sessions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30369 seconds with 12 queries