Código fuente de 'Contador de visitas 2.asp'

<html>
<head>
<title>Contadores ASP. Contador de visitas 2. Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<body style="font-family: Arial; font-size: 9pt">
<p align="center"><b><font size="3">Contador de visitas 2</font></b></p>
Simple contador de visitas que almacena el número de hits en un 
fichero de texto &quot;Contador.txt&quot;</font> (si este no ha sido creado, se 
crea automáticamente).<br>
<br>
<%
on error resume next 

' Create a server object
set fso = createobject("scripting.filesystemobject")

' Target the text file to be opened
set act = fso.opentextfile(server.mappath("Contador.txt"))

' Read the value of the text document
' If the text document does not exist then the on error resume next
' will drop down to the next line
counter = clng(act.readline)

' Add one to the counter
counter = counter + 1

' Close the object
act.close

' Create a new text file on the server
Set act = fso.CreateTextFile(server.mappath("Contador.txt"), true)

' Write the current counter value to the text document
act.WriteLine(counter)

' Close the object
act.Close

' Write the counter to the browser as text
Response.Write "Número de visitas: " & counter
%> 
</body>
</html>