ASP Web Counter


If you're tired of free web counter services that just make you copy and paste the code for an image of some numbers into your web site, this article is for you. It will explain in easy steps how you can create a professional, and invisible, web counter. The numbers appear as normal text, no more ugly looking pictures! You will also learn how to use a cookie, ensuring that the same visitor isn't counted twice in, say, 2 hours, as well as a cookie so that you can visit your own site without distorting statistics.

Step 1: Create the file for the number to be stored in.

This counter works by storing a number in a text file, then reading or updating it accordingly. So, create a text file called "counter.txt" somewhere on your web server. Make sure the file isn't read only (you'll probably have to email your provider and ask them to grant it write access.) Put the value "0" [zero] in the text file, with no spaces before or after it.

You might also like...


About the author

Paul Freeman-Powell

Paul Freeman-Powell United Kingdom

Paul has been a keen web developer since the age of 11, creating a variety of web sites over the years, which gradually increased in quality as well as complexity as he learned and became famili...

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The trouble with programmers is that you can never tell what a programmer is doing until it's too late.” - Seymour Cray