Use Page Counter component to count how many times the current page was hit
Use Page Counter component to count how many times the current page was hit
Rate Use Page Counter component to count how many times the current page was hit
(3(3 Vote))
<HTML>
<HEAD>
<TITLE>ASP 2.0 Demo - The Page Counter Component</TITLE>
</HEAD>
<BODY>
<H2>ASP 2.0 Demo -The Page Counter Component</H2>
<HR>
This sample show how to use <B>Page Counter</B> component to count how many times the current page was hit. This component is implemented in file <B>PAGECNT.DLL</B>. Make sure you have it on your server and installed properly. You can use the Personal Web Server to test this ASP page.
<P>
<font color=blue>How to: Click the Refresh or Reload menu button to see the result ! </font>
<HR>
<P>
<%
Dim objPC
Dim lngHitCount
On Error Resume Next
Set objPC=Server.CreateObject("IISSample.PageCounter")
If IsObject(objPC)=False Then
Response.Write "The Page Counter component object can not be created at this time. "
Response.Write "Either you do not have this component on the server machine or it "
Response.Write "is not installed properly."
Response.Write "You may try to fix this problem by installing IIS Resource Kit."
Else
Response.Write "The Page Counter component object is created successfully !<P>"
lngHitCount=objPC.PageHit()
Response.Write("Number of times (reset one) this page was hit - ")
Response.Write cstr(lngHitCount)
Response.Write("<BR>")
If ((lngHitCount Mod 10)=0) Then
Response.Write("<font color=red><P>You hit the lucky number.</font><BR>")
If (lngHitCount>=100) Then ' Reset count.
objPC.Reset
Response.Write("The page counter was reset every time it reaches 100 !")
End If
End If
End If
%>
<P>
</BODY>
</HTML>
Use Page Counter component to count how many times the current page was hit Comments
No comments yet — be the first to post one!
Post a Comment