Solved

Tracking Visits to my Web Site

Posted on 1997-06-24
2
187 Views
Last Modified: 2013-12-25
A) The current web site I am working on I created using Microsoft Visual Interdev

B) the problem > I track the number of visits to the web site in a text file.  I use the Session_OnStart routine in global.asa via VBSCRIPT.

The process is to 1) load the text file in to get the count, 2) close that file, 3) re-create the file writing the new total of visits.

Finally, my question> What happens if two people access the file at the same time?  How can I protect from any possible file problems?
0
Comment
Question by:MLHAMMEL
2 Comments
 
LVL 5

Accepted Solution

by:
icd earned 30 total points
ID: 1828532
If two people access at the 'same time' then the worst that can happen is that one visit will not be counted. Imagine the counter having the value 100

Visitor A opens the file, reads 100
Visitor B opens the file, reads 100
Visitor A writes the value 101
Visitor B writes the value 101

With more complex data manipulations it can cause inconsitancies between dependent data which can cause your database to become corrupted.

The normal way of locking in perl is to use the 'flock' command. I have not used VBSCRIPT but there is likely to be a similar method in that language. Do a search for 'lock'. To do an update you first obtain the lock, make the read, increment it, write the file back again and then free the lock. Another process wanting to do an update will have to wait for the lock to become available.

On my own web site I don't bother with file locking in this type of case since the data is fairly inaccurate anyway. So long as it does not corrupt the data I don't mind.

0
 

Author Comment

by:MLHAMMEL
ID: 1828533
I did some research and you are right about the LOCK command.  I am using Application.Lock, Application.Unlock

Good anwser.

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now