-
User online?
I am going to try to set my web page up like an old BBS I ran in the mid 90's. On feature it had, that I have seen on other sites (including vbforums) is it would show a list of users logged in.
How could I implement this?
My ideas:
When a user logs on, have a boolean field in the DB record for that user turn on.
Problems- what if they use a cookie that doesn't expire... will they alway be "online"
- how do I turn them "offline" if they don't click on a logout button.... or is there a On_ticket_expired_event?
Any ideas?
-
best way would be to create a collection or array and store the user name and their session id into the collection. You can check on session closing to remove that user from the colelction in the situation they dont log off properly. How many people do you know of that actually log off correctly?.. :p
-
Sorry to sound ignorant, but how do I determine session ID... I didn't realy even realize there was an actual "session"...
I don't know if this makes a difference but i'm using Form based authentication.
-
I would be intrested in hearing how you solve this problem. All I can think is maybe there is something in IIS that can help you with this task.
-
it is something like Session.SessionId
or something like that.
-
if it was me I would log the user's entry onto the webpage by collecting the request info when the open the page, and when they leave the page:
TextBox1.Text += ("\nUser Host:" + Request.UserHostAddress);
TextBox1.Text += ("\nUser Host Name:" + Request.UserHostName);
TextBox1.Text += ("\nLogin Time:" + System.DateTime.Now.ToString("dd/MM/yy"));
Then compare the two times ( I guess minutes rather than days would be more helpful!) to get the amount of time spent on each page. You could send the data up to your sql server db everytime there is a change...