Typically we use the term 'Thread safety' to refer to issues related to code
in a process modifying memory locations simultaneously (since all threads in
a process share the same Virtual memory space) resulting in unexpected
behaviour.
Yes multiple request can be processed simultaneously in different threads.
I'm not sure how you tested this but a call to OpenTextFile will throw a
permission denied if you attempt to open for write or append a file already
open elsewhere. In you C# version were you discarding and/or closing the
log file? In C# it would be much easier to have a singleton log file object
that serialised calls write a log.
There is no builtin way to synchronize ASP threads.
All I did to test it was to open the log file in one thread and not
close it. I realize now though, after reading your first post, that
such as test won't work since the log file is closed by the system
when the reference goes out of scope. I suppose I would have to force
the thread to wait while the reference is still in scope and the file
is still open while the other thread comes in and tries to open it in
order to recreate the permissions error you mentioned.
I only mentioned the C# code as a reference for something that worked
in a way I understood. I was able to write C# code that gave me an
error when multiple threads tired to write to the file; but couldn't
do that in VBScript (now I know why). The app I'm working on is a
classic ASP web application, by the way.
The way I would solve this problem is C#, like you suggested, would be
to have a logging class that synchronized thread access to the file.
Is there a way to do something like this in VBScript? How do people
normally deal with logging in classic ASP?
Dave