Here is some code I created many years ago to log events on a web site using Classic ASP. All the code was placed into an include file called logEvent.asp.
logFile = "C:\SomePath" Sub LogEvent (pageName, user, message) Const ForWriting = 2 Const ForAppending = 8 Set fs = CreateObject("Scripting.FileSystemObject") If fs.FileExists(logFile) Then Set logFile = fs.OpenTextFile(logFile, ForAppending) Else Set logFile = fs.CreateTextFile(logFile, True) End If logFile.WriteLine(Now() & vbTab & pageName & vbTab & user & vbTab & message) logFile.Close Set logFile = nothing Set fs = nothing End Sub
Add this include line from each page you wish to use the Logging script.
<!--#include virtual="/inc/logEvent.asp" -->
The last step is to actually write to the log file.
Call LogEvent("Home", "Larry King", "Referred from Google")
