hi
I need to restrict my user i.e., if a user is loged in from a browser he shouldnot be allowed to
login again from other browser/window until he logs out.
plz do help me to solve this. i am using login control of asp.net for login purpose.
thanx in advance.
Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)
![]() |
0 |
![]() |
You need to overload OnLoggingIn method of Login control. Then you should to check is Membership.GetUser(username).IsOnline true or false. In case of true - e.Cancel = true;
May the Force be with you
![]() |
0 |
![]() |
Yes, It can be done like this
protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e) { e.Cancel = Membership.GetUser(Login1.UserName).IsOnline; }Hope it helps!!
.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
![]() |
0 |
![]() |
<asp:Login ID="Login2" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"
ForeColor="#333333" Visible="False" Width="372px" OnLoggedIn="loggin">
<TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<LoginButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" ForeColor="#990000" />
</asp:Login>this is my login control i placed OnLoggedIn="loggin" and in that function i had written this
Dim username As String
username = Login2.UserName.ToString
If Membership.GetUser(username).IsOnline = True Then
Dim ba As Stringba="dosomething"
End Iffor checking purpouse but when i login with my username it is not going in to this
If Membership.GetUser(username).IsOnline = True Then
Dim ba As Stringba="dosomething"
End Ifplz do help me
thanx in advance.
Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)
![]() |
0 |
![]() |
applied this
e.Cancel = Membership.GetUser(Login2.UserName).IsOnline
but geting syntax error near e.Cancel
Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)
![]() |
0 |
![]() |
Public Sub loggin(ByVal sender As Object, ByVal e As System.EventArgs)
Session("validlogin") = True
Dim username As String
username = Login2.UserName.ToString
e.Cancel = Membership.GetUser(Login2.UserName).IsOnline error here.
Login2.DestinationPageUrl = "~/mwmenu.htm"
End Sub
Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)
![]() |
0 |
![]() |
sushmithashalini:
<asp:Login ID="Login2" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid"
BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"
ForeColor="#333333" Visible="False" Width="372px" OnLoggedIn="loggin">
<TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<LoginButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px"
Font-Names="Verdana" ForeColor="#990000" />
</asp:Login>Do it in OnLoggingIn="Login1_LoggingIn"
like
protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e){
e.Cancel = Membership.GetUser(Login1.UserName).IsOnline;}
.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
![]() |
0 |
![]() |
hi
can u plz tell me how to overload onLoggedIn method.
Thanx in advance.
sushmitha.
Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4)
![]() |
0 |
![]() |
sushmithashalini:
can u plz tell me how to overload onLoggedIn method.I can not understand why you want to do thi??? The simplest solution lies in OnLoggingIn not, onLoggedIn
<asp:Login ID="Login2" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt" ForeColor="#333333" Visible="False" Width="372px" OnLoggedIn="loggin" 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>protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e) { e.Cancel = Membership.GetUser(Login1.UserName).IsOnline; }
.NET-ified
Arpit Khandelwal
Please: Don't forget to click "Mark as Answer" on the post that helped you.
That way future readers will know which post solved your issue.
![]() |
0 |
![]() |