if user opened the page once and close the browser would be displayed as connected for certain interval of time it wont get refresh immd. is that you issue or something else
In which event do you call above code? Obviously, the membership doesn't update the state of the user as you wish. Of course, membership won't do wrong, so you make something wrong for login and out for the state of users.
salim20001
Member
154 Points
507 Posts
List of user on ligne
May 31, 2012 10:55 AM|LINK
Hi,
any help PZL on taht, I get the wrong user connected, wht's wrong with the code ?
Dim OnlineUsers As New MembershipUserCollection() Dim AllUsers As New MembershipUserCollection() AllUsers = Membership.GetAllUsers() For Each user As MembershipUser In AllUsers If user.IsOnline Then OnlineUsers.Add(user) End If Next Dim OnlineUserCount As Integer = OnlineUsers.Count lblSessionCount.Text = OnlineUserCount.ToString() OnlineUserList.DataSource = OnlineUsers OnlineUserList.DataBind() <asp:GridView ID="OnlineUserList" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" style="text-align: center; font-weight: 700" Width="663px"> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <Columns> <asp:BoundField DataField="UserName" HeaderText="Utilisateur" /> <asp:CheckBoxField DataField="IsOnline" HeaderText="Connecté ?" /> <asp:CheckBoxField DataField="IsApproved" HeaderText="Active ?" /> <asp:BoundField DataField="Email" DataFormatString="<a href=mailto:{0}>{0}</a>" HeaderText="Email" HtmlEncode="false" /> </Columns> <RowStyle BackColor="#EFF3FB" /> <EditRowStyle BackColor="#2461BF" /> <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" /> <PagerStyle BackColor="#000077" ForeColor="White" HorizontalAlign="Center" /> <HeaderStyle BackColor="#000077" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> <EmptyDataTemplate> No User Online now </EmptyDataTemplate> </asp:GridView>Mudasir.Khan
All-Star
15346 Points
3142 Posts
Re: List of user on ligne
May 31, 2012 11:00 AM|LINK
if user opened the page once and close the browser would be displayed as connected for certain interval of time it wont get refresh immd. is that you issue or something else
salim20001
Member
154 Points
507 Posts
Re: List of user on ligne
May 31, 2012 11:22 AM|LINK
I tested:
user2 connected and user3 connected and me connected (user4)
and as a result I got
user1 connected and user2 connected
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: List of user on ligne
Jun 04, 2012 07:58 AM|LINK
Hi,
In which event do you call above code? Obviously, the membership doesn't update the state of the user as you wish. Of course, membership won't do wrong, so you make something wrong for login and out for the state of users.
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework