C# Online users

C# Online users

   You can get who is online and how many users online using ASP.net 
you need to configure your Database and Web application to use ASp.net membership provider
After configuring add lbOnlineUsers as a listbox in your page to display who is online

Below code will return number of users online and who is online 

 

System.Collections.Generic.List<string> lstUser = new System.Collections.Generic.List<string>();

int numberOfOnlineUsers = Membership.GetNumberOfUsersOnline();

foreach(MembershipUser u in Membership.GetAllUsers())
      
 // Membership.GetAllUsers will returm MembershipCollctions which holds individual Membership User objects 

 {
    if(u.IsOnline) 
   { 
     lbOnlineUsers.Items.Add(u.UserName); 
   } 
 } 
 

 This way online users will get added to listBox control on Page

Some cool stuff about Membership provider can be found at http://www.revenmerchantservices.com/search.aspx?q=membership

 

Online html editor online JavaScript editorMemberShip Count Online UsersC# foreach loophow to purchase onlineFree Online Eye Testc# arraylistc# stringC# DateTime DifferenceC# XML XmlReaderC# Binary To StringC# Regular Expression Get Text Between Brackets

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.