Click here to Skip to main content
14,827,000 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
My project title was peak load management, in that I want to count the number of users that view the page, e.g. 10 members can view the page if more than 10, display msg (try after some time).

Thank you in advance
Ashok kumar
Posted
Updated 6-Mar-10 23:08pm
v2

1 solution

Write code in global.asax file which interacts with the entire application.
The sample code is given below:

C#
void Application_OnStart(Object Sender, EventArgs E)
        {
            Application["CurrentUsers"] = 0;
        }
        void Session_OnStart(object Sender, EventArgs E)
        {
            Application.Lock();
            Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) + 1;
            Application.UnLock();
        }
        void Session_OnEnd(object Sender, EventArgs E)
        {
            Application.Lock();
            Application["CurrentUsers"] = System.Convert.ToInt32(Application["CurrentUsers"]) - 1;
            Application.UnLock();
        }


Hereafter you can try it for your issue.
   
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