Hello friends,
I want to know the code for how many hits my site currently get.OR How many visitors visits our site.
If anyone found this code please mail me to
Hello friends,
I want to know the code for how many hits my site currently get.OR How many visitors visits our site.
If anyone found this code please mail me to
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K pointsPosted Apr 24, 2008, 3:57 PM EDT
create a new integer
in the void Session_Start(Object sender, EventArgs e) even handler add this code
Application("Count",0);
in the void Session_Start(Object sender, EventArgs e) handler add this code
int UserCount = Convert.ToInt32(Application.Get("Count").ToString());
UserCount +=1;
Application.Set("Count",UserCount);
in the in the void Session_End(Object sender, EventArgs e) handler add this code
int UserCount = Convert.ToInt32(Application.Get("Count").ToString());
UserCount -=1;
Application.Set("Count",UserCount);
then go to your page and add a Label and name it lblCount
use this code to get the application visitor in the lblCount
lblCount.Text = Application.Get("UserCount").ToString();