locked
Restrict concurrent user access in asp.net RRS feed

  • Question

  • User1607087669 posted

    Requirement <o:p></o:p>

    Suppose there is user with username TEST and if he is login from machine A  then we want from another machine  B  if a person tries to login with  TEST User name he should not be allowed to login.  <o:p></o:p>

    <o:p> </o:p>

    I have tried this code to do this<o:p></o:p>

            MembershipUser objr = Membership.GetUser(txtUsername.Text, false);
    
    
               online = objr.IsOnline;
    
                if (online ==true)
                {
                    Response.RedirectPermanent("http://localhost/logistics/unauthorized.aspx");
    
     
                  
                }
    
    //and in web.config i have added this
    
        <membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="1">
    

    But problem is that this code only runs for 1 min a user tires to login after 1 min then he is able to login with same user name and password

    I am using asp.net membership and C#.

    Thursday, January 2, 2014 8:38 AM

Answers