title: List of online users using membership asp.net
body: <p>I want to have a list that contains online users in my web site i use this code in local host but it did't shows me any user. Can any body help me? where did i make mistake?</p>
  
  <pre><code>  MembershipUserCollection users;
  
  
          if (!IsPostBack)
          {
              // Bind users to ListBox.
              List&lt;MembershipUser&gt; onlineUsers = new List&lt;MembershipUser&gt;();
              foreach (MembershipUser user in Membership.GetAllUsers())
              {
  
                  if (user.IsOnline)
                  {
                      onlineUsers.Add(user);
  
                  }
  
              }
              ListBox1.DataSource = users;
              ListBox1.DataBind();
  </code></pre>