View Full Version : logging visitors' details to a flat file

05-20-2007, 12:20 PM

i'm using .asp and want to log users' visitation details (times, dates, etc) to a flat file located on my web-server.

i know that i could do this simply by creating a file system object through .asp, but is this necessarily the best way to go about it?

i'm thinking that there will probably be file locking issues associated with logging the details of every visitor in the same file, and so would i be better off using some sort of cgi script (yeah, i know there's a seperate forum ;-) )?

ideally, i'd like the file writing process to run independently of the .asp code, so that the user wouldn't be left waiting to receive their web page while the 'logging' file was being written by another user.

i realise that i might be approaching this from completely the wrong angle, but if anyone knows of the best way to acheive my goal then I'd grateful if you could help me out.

thanks! :)

05-21-2007, 04:16 PM
Scripting.FileSystemObject is the best way to go about this, if you are hating life... =)

Have you thought looking into the IIS logging? IIS keeps track of all of this stuff for you already (and can keep track of a lot more).

Just go into IIS.mmc > Right-Click your site > Properties.

Enable Logging is checked by Default. Go into Properties here and you can change your logging schedule. If you go into Advanced, you can track things like Date and Time of visitor, Client IP, Username (if available), and a whole bunch more.

So now that you have it, how do you mine the data?

Here are a couple of log parsers that you can use:

My Favorite (but requires .NET 2.0 framework)




one of the other xxx's of share/free wares out there.


05-22-2007, 08:27 AM

Thanks, daemonspyre!

05-26-2007, 02:26 AM
As far as I know you don't get locking issues if you only use ASP anyway (could be wrong, but no matter how heavy my asp pages get I have never once had a lock issue, I think it might just queue up to use it in the app pool or something)

The IIS logs can be pretty good anyway (if you can find them on the server for your particular site and of course if it is your server so you have access to them) and aren't hard to parse manually.

If you didn't want to do this, you could just print out Request.ServerVariables to a line of the text file, attached to the date. This is pretty simple (expect it to get large quickly if you have a heavy site and you print out every servervariable) and I wouldn't expect any locking issues.