Click here to Skip to main content
15,905,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display active/logged in users count in master page.
How to implement that in global.asax?
Posted

Ok fine i got the proper solution for this

C#
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Application["OnlineVisitors"] = 0;
}



C#
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Application.Lock();
Application["OnlineVisitors"] = (int)Application["OnlineVisitors"] + 1;
Application.UnLock();
}

XML
<td style="color:Red">
<%=Application["OnlineVisitors"].ToString()%>
</td>
 
Share this answer
 
Comments
Lakhan Anjana 15-Sep-15 3:25am    
he is taking about active user not visitors...
C#
void Application_Start(object sender, EventArgs e)
{
//
//like select COUNT(USERID) where useractive==true...and after on every 5 or 10 second call this function so every thing will be updated.
//set false useractive on user logout 
}
 
Share this answer
 

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