How can I count page views so that when I go and refresh the page the counter doesn't consider it as new view?
1-declare a session for each user
2- declare application variable for the page visited
and after you start the session
check if page visited like the following:
on the user login page or homepage:
Session["pageVisited"] = false;
when user visit the page write in the code behind:
if(SESSION["pageVisited"] == false)
{
APPLICATION["Page1Visited"] = Convert.Toint32(APPLICATION["Page1Visited"]) + 1;
SESSION["pageVisited"] = true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With