C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




need script for site meter


Posted Date: 04 Jul 2008      Total Responses: 2

Posted By: G.Hemadribabu       Member Level: Gold     Points: 1



hi

i want to introduce a concept in asp.net like , currently in this second how many users are viewing this page .

I had already hosted the page in the internet , so at the bottom of the page i need to introduce a small column which shows me how many viewers are currently viewing at this second .

Pls tel Me how to do it

thank you
hemadribabu





Responses

Author: Shivshanker Cheral    04 Jul 2008Member Level: DiamondRating:     Points: 6

refer

Global.asax with the following for tracking the user sessions and displaying the count of logged in users, but this doesn't work properly for users who just close their browsers or logout of the application. In addition my update panel is never updating the count in realtime.


void Application_Start(object sender, EventArgs e) { // Start tracking the number of active sessions when the application starts.
Application.Add("userLoginCount", 0);}void Session_Start(object sender, EventArgs e) { // Increase the count of active sessions as they come on.
int userLoginCount = Convert.ToInt32(Application.Get("userLoginCount").ToString()); userLoginCount++; Application.Set("userLoginCount", userLoginCount);}void Session_End(object sender, EventArgs e) { // Decrease the number of active sessions as they end.
int userLoginCount = Convert.ToInt32(Application.Get("userLoginCount").ToString()); userLoginCount--; Application.Set("userLoginCount", userLoginCount); }On my MasterPage I a label that contains the count. I've created a property, so that I can access the label as opposed to using FindControl.The code below is on my Default.aspx page. // Get the number of active sessions and display it.
Master.GetSessionCount = Application.Get("userLoginCount").ToString();


http://forums.asp.net/t/1155945.aspx



Author: Siddesh Kapadi    04 Jul 2008Member Level: SilverRating:     Points: 4

Set a session variable when a user visits the page and unset the variable when the user goes to some other page and increase the count when the user session is set. This will help you eliminate the user page refresh scenario.


Post Reply
You must Sign In to post a response.
Next : OpenDialogBox in ASP.NET
Previous : Error:The name 'IsNumeric' does not exist in the current context
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use