Mail & Web
Outsourcing
Shop & CMS
Eksemplet nedenfor viser hvordan en simpel tæller kan laves i ASP. Antallet af besøgende gemmes i "/log/Counter.log".
Download eksempel: Counter.zip
<html> <head> <title>ASP Counter</title> </head> <body bgcolor="#FFFFFF"> <% Set fs = CreateObject("Scripting.FileSystemObject") LogFile = Server.MapPath("log/Counter.log") Set rf = fs.OpenTextFile(LogFile, 1, False) LastCount = rf.ReadLine Count = LastCount + 1 Set wf = fs.OpenTextFile(LogFile, 2, True) wf.WriteLine(Count) wf.Close rf.Close Set wf = nothing Set rf = nothing Set fs = Nothing %> <p><%=Count%></p> </body> </html>