Home > ASP.Net > Prevent Login twice

Prevent Login twice


Hi

try this example:

protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
{

e.Cancel = Membership.GetUser(Login1.UserName).IsOnline;
}

//————-Another way —————

<asp:Login ID="Login1" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid"
                BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"
                ForeColor="#333333" Visible="False" Width="372px" OnLoggingIn="Login1_LoggingIn">
                <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                <LoginButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px"
                    Font-Names="Verdana" ForeColor="#990000" />
            </asp:Login>

 in code behind :-

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

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: