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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Niradhip ChakrabortyPosted Apr 24, 2008, 1:01 PM
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";
}
srinvas dontulaPosted Apr 24, 2008, 8:09 AM
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.