Home > ASP.Net > Prevent Multiple Login at the same time

Prevent Multiple Login at the same time


Hi

Try this:

protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
{
e.Cancel = Membership.GetUser(Login1.UserName).IsOnline;
}

or try this code

Puplic void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
{
MembershipUser u = Membership.GetUser(Login1.UserName); Response.Write(u.IsOnline);
if (u.IsOnline)
{
Login1.FailureText = "A user with this username is already logged in."; e.Cancel = true;
}
else
{
Login1.FailureText = String.Empty;
e.Cancel = false;
}
}

Good Luck

Advertisements
Categories: ASP.Net
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: