O'Reilly logo

Active Server Pages 3.0 from Scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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") ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required