.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Online users..

Posted By: susant     Posted Date: September 30, 2008    Points:2   Category :ASP.Net
hey
I want to show in my home.aspx page currently how many number of users are online i mean like

susant
prakash
satish
ompraksh
kavita

so these people are currently online to my web-site.. i am in confuse like in global.aspx i have to write code or in database i have to take one status field.... i need help

susantaown@gmail.com
TahnX,..

Responses
Author: Amit Mehra             
Posted Date: September 30, 2008     Points: 5   

Hi,
Try this

MembershipUserCollection OnlineUsers = new MembershipUserCollection();
MembershipUserCollection AllUsers = new MembershipUserCollection();
AllUsers = Membership.GetAllUsers();

foreach (MembershipUser user in AllUsers)
{
if (user.IsOnline)
{
OnlineUsers.Add(user);

}
}
int OnlineUserCount = OnlineUsers.Count;

lblSessionCount.Text = OnlineUserCount.ToString();

OnlineUserList.DataSource = OnlineUsers;
OnlineUserList.DataBind();




Thanks,
Amit
Please "Mark As Answer " if this post help you.
Author: susant             
Posted Date: October 01, 2008     Points: 5   

hello Amit I am not using membership or profile service.. for simple web-application how can i do that.. Ur code is ok for membership.

Author: Amit Mehra             
Posted Date: October 01, 2008     Points: 5   

Hi Susant,
Then you have to go with Database.

Thanks,
Amit
Please "Mark As Answer " if this post help you.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend