The Page Counter Component

Finally, you might want to get some idea of how frequently your page is being accessed without having to dig through the server logs. The Page Counter component enables you to do that with just a few lines of code. We can add this under the banner ad on index.asp with the code in Listing 3.31.

Code Listing 3.31. index.asp: Adding a hit counter
…
31:<A href="register.asp">
32:<IMG SRC="images/register.gif" BORDER=0 ALIGN="middle" ALT="Register"
HEIGHT="39" WIDTH="39">
33:Register</A> -- jump on board
34:<P>
35:<%
36:    set AdvObject = Server.CreateObject("MSWC.AdRotator")
37:    adHTML = AdvObject.GetAdvertisement("ads/AdRotatorSched.txt")
38:    Response.Write adHTML
39:%>
40:
41:<% set pageCount = Server.CreateObject("MSWC.PageCounter") ...

Get Active Server Pages 3.0 from Scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.