ASP Hit Counter

 

The following ASP script will produce a hit counter.

Please remember to set read / write access to the file named “count_asp.txt”

 

Example

Current visits to this page: 1359

 

Script Source

<%
Set FS=Server.CreateObject("Scripting.FileSystemObject")
Set RS=FS.OpenTextFile(Server.MapPath("count_asp.txt"), 1, False)
fcount=RS.ReadLine
RS.Close

fcount=fcount+1


Set RS=FS.OpenTextFile(Server.MapPath("count_asp.txt"), 2, False)
RS.Write fcount
RS.Close

Set RS=Nothing
Set FS=Nothing

%>

<p>Current visits to this page: <%=fcount%></p>

Please let me know if this script was helpful to you.

[rating]