Hello friends,
I want to know the code to calculate how many no.of hits our site gets.OR how many persons visit our site.
Hello friends,
I want to know the code to calculate how many no.of hits our site gets.OR how many persons visit our site.
Know the answer? Post it. Somebody with the same question will find it here.
srinvas dontula3 pointsPosted Apr 24, 2008, 4:09 AM EDT
You can count the no of user requested your site by writing code in the global.asax file. in that file there is a method called application_sessionstart.create one variable which is a globar variable.
Niradhip ChakrabortyRank #428 · 5.8K pointsPosted Apr 24, 2008, 9:01 AM EDT
You can refer the following URL:
http://www.stardeveloper.com/articles/display.html?article=2002102501&page=1
You also can refer the following code:
protected void Page_Load(object sender, EventArgs e)
{
Application.Lock();
if(Application["HitCount"]!=null)
{
Application["HitCount"]=(int)Application["HitCount"]+1;
}
else
{
Application["HitCount"] =1;
}
Application.UnLock();
lblInfo.Text="The page has been accessed ("+Application["HitCount"].ToString()+") times";
}