A counter should count the number of users visiting a web page. If a user opens a specific page, the counter should increase, create a new image, and save the number of visitors in a file. The number should only increase if the visitor is new. If you increment the number of visitors every time the counter is displayed, then obviously you do not get the correct numbers of unique visitors, and will then get the number of page views instead.
So, we only need to increment the counter if we’re dealing with a new visitor. We can do this with a cookie, using standard browser functions. With a cookie, we can send the browser a flag that the current user has already visited our web page. If the user comes back within 120 seconds then we will ignore this cookie and increment the counter.
Let's start with our JScript.Net code... |