Single User Login At A Time

J

Joey Lee

Hi,

Does anyone knows how to control user login that only a single userid can
login at a time?

Thanks

Joey
 
K

Ken Cox [Microsoft MVP]

You could store the ID of all users in an Application variable or a database
and check if that one is in use. Of course you'd need to make sure the
person logged out properly so you could remove the ID.
 
J

Joey Lee

Thank. Actually that is the problem which i am currently facing. I keep the
userid in the cache and do checking. But if the user just click on the "x"
button closing the browser. he will be log out until the cache expire or my
undetermined session_end method in global.asax fires to kill of the
information in cache.

Is there a better way??

Joey
 
L

Lisa Pearlson

This is a very common problem. Too bad that there isn't a standard HTML tag
that allows something like this:

<ONCLOSE href=http://mysite.com/logout.aspx />

I'm not sure if JavaScript can handle this. Downside of JavaScript is that
it can be disabled by the user, or unsupported by browser. I think and
<onclose> html tag should've been part of standard html.

Since it isn't, I think using timeouts is the only way. You can try limiting
the timeout to 5 minutes, and every time there is activity on the webpage,
you reset the timer. This means if the user stares at the same page for 5
minutes, the login session expires.
This could be eased with a JavaScript code that calls a
http://mysite.com/keepalive.aspx, to reset the timer.

Lisa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top