pmillio
pmillio

Reputation: 1139

Check if another user is logged in for messaging

Is it possible to find out if another user is logged in on a website using ASP.NET Forms Authentication?

How can I go about implementing this scenario?

Upvotes: 1

Views: 301

Answers (3)

ibram
ibram

Reputation: 4579

I'm doing this through the forms login and global.asax. If someone successfully is logged in, I add his/her username and session id in a dictionary in a application value, which is global accessible. If I get a Session_end in global.asax, I remove this entry.

Upvotes: 0

BugFinder
BugFinder

Reputation: 17858

Well, if you have a list of "active sessions" in your database, it should know if a users login is currently valid, about to run out, or inactive. If you have a script that is polling for messages, if a message is sent and it cant send, then the message goes to inbox, or, it shows on a screen.

Upvotes: 3

Ian Devlin
Ian Devlin

Reputation: 18870

Normally some session variable will have been set with, for example, the logged in user id. Check if that exists, and if so, they're logged in.

I haven't used Formsauthentication myself though, so am unable to be exact.

Upvotes: 0

Related Questions