Count visitors
-
What is the best way to count my website visitors? "I am too late but i will never give up"
well you can keep a counter in global.asax in session _Start event Enjoy Coding
-
What is the best way to count my website visitors? "I am too late but i will never give up"
-
well you can keep a counter in global.asax in session _Start event Enjoy Coding
Hi.. Thank you for your respond..I know how to use the application and session state variables and i have used the following code : protected static int m_ActiveUsers; public static int ActiveUsers { get { return m_ActiveUsers; } } protected void Application_Start(Object sender, EventArgs e) { Application.Lock(); m_ActiveUsers=0; Application.UnLock(); } protected void Session_Start(Object sender, EventArgs e) { Application.Lock(); ++m_ActiveUsers; Application.UnLock(); } protected void Session_End(Object sender, EventArgs e) { Application.Lock(); --m_ActiveUsers; Application.UnLock(); } But the problem it doesnt give me the right number always.Some times this code tells me there is two visitors while there is no one except me.And some times it doesnt decrement the visitors count number when i exit. Do any one know how to make a better way that wont be affected by application errors and will solve my problem? :confused: "I am too late but i will never give up"
-
In the global.aspx file Application_start() application("visitor")=0 Now at Webpage load Application("c") = CType(Applicatrion("visitor") , integer) + 1 Label1.text = "You ar visitor no " & Application("c")