ASP Web Counter

Conclusion

The code should be pretty self explanitary. It makes sure you're allowed to change the counter, and that you're putting in a proper number. Then it uses the same principal as previously to change the value in the counter to the new value you've just put in. If all has gone well, it then looks again (this is necessary, otherwise the old value will be displayed... simply incrementing that proves nothing) to confirm the new value and produce a nice message saying it was successful. If not, it informs you of the error.

Not being counted yourself.

This is extremely simple. All you need to do is make a page that will set you a different cookie, telling the web site that you are an adminstrator. Then, when putting the counter value up on the main page, add that as another condition that must be met in order for the number to be increased (you'll have to add that to *both* places where it sets for the "recentvisitor" cookie).

You might also like...

Comments

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.

Contribute

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.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook