Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to show online users my asp.net application? i'm using SQL table to store username and passwords.please help me.
Posted
Comments
Shubham Choudhary 8-Oct-13 4:08am    
Hi @amnk !!!
If u have table like username and password so make a flag or use bool value to insure who user is log in or log out like
if(user_login==true)
{
blool value= 1;
}
else
{
bool value=0;
and then count the true value and show it
}
amnk.info 8-Oct-13 4:56am    
thanks. i will try

Refer -

1. How to check in ASP.NET if the user is online?[^]
Quote:

The ASP.NET Membership service supports this feature. To get the particular user's last activity date, use LastActivityDate property and to indicate whether the user is online or not use IsOnline property. Also to get the number of online users, use GetNumberOfOnlineUsers. Of course, the ASP.NET Membership service does not save the last IP address, and you have to override some behavior of SqlMembershipProvider in this case.

2. Show Online Users/Visitors in ASP.Net website[^]
 
Share this answer
 
Comments
amnk.info 8-Oct-13 5:04am    
Thanks Tadit. I will try
Most Welcome.

Please accept this answer, if it has helped you in any way.
This will help others to find the answer in one go and you will also be awarded with some points for this action...

Thanks,
Tadit
Check similar CP thread first:
How to see who is online in asp.net website c#[^]

Then i should say, if you use Membership[^] then simply call Membership.GetNumberOfUsersOnline[^].

Also view:
Get online users in ASP.NET[^]
 
Share this answer
 
v3
Comments
amnk.info 8-Oct-13 6:22am    
Thanks for help. i will try
ridoy 8-Oct-13 6:44am    
will be glad if those can help you.
Display the number of users/sessions currently active your website.
Using the Session_Start and Session_End Events

VB
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
Application("UserCount") = Application("UserCount") + 1
End Sub

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends 
Application("UserCount") = Application("UserCount") - 1
End Sub
To Display UserCount, add a Label Control to the WebForm, name it lblUserCount

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Me.lblUserCount.Text = "User(s) online " & Application("UserCount")
End Sub
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900