strFileName: It will be the physical file storing the number of visits. When COM component is initialized, the property will be set to "MyCounter.txt".
It has three methods.
SetCounter(option lNum as Long = 0): This method will be used to reset counter. The default value is 0.
GetCurCounter(): This method will return the current value of the counter
Increment(): This method will increase the counter by One and return the updated value of the counter.
If an error happened in the COM component, an error will be raised with error number, name of the method caused the error and the description.
Dependency:
The COM component use FileSystemObject to handle file access.
Sample Usage:
Register the COM component either by regsvr32 or MTS.
Then in asp page, include following code
------------------------------------------- <% response.write "This page has been accessed " & counter() & " times" %>
<script runat = server language = vbscript> function counter() dim obj set obj = server.createobject("WebCounter.Counter") dim iNum obj.strFileName = "PageCounter.txt" counter = obj.Increment () set obj = nothing end function </script> ---------------------------------------------
If you want to count the number of visit for each individual page, simply assign unique value for the "strFileName" property for each page.