Link to home
Start Free TrialLog in
Avatar of rockymagee
rockymagee

asked on

VBScript Execution Cycle

I have a script which collects information from a web form and writes the inputs into a .txt file and then forwards the .txt file as the body of an email.

I am concerned as to whether multiple users filling in the form may be able to hit the submit button at the exact same time and run the script simultaneously causing a collision where the user writes over the others text file, thus mixing user information.

I was wondering if anyone knows the order of process for vbscript? Will script wait till it completes one cycle before starting another?

Or will the server lock the .txt file while it is being written too? Will this throw an error?

I am trying to understand the underlying sequence before I write additional code to create uniques text file names and deleting them once I know they have been passed on to the mail server.

Open for discussion....

SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi rockymagee,

Why not just use the session ID for you file name:
  strFilename = <path> & session.sessionID & ".txt"

The session ID is generated by the server when the user connects to the session and is very simple to access.  You code to Session_OnEnd section of the global.asa file to automatically deal with temp files that don't get deleted properly.

Hope this helps,
Neal.
Avatar of rockymagee
rockymagee

ASKER

Thanks for the responses .... I am going to implement the unique file fix using the session ID as the file name.  

Neal:

Can you give me a little more explanation on using the global.asa to deal with the temp files ....



ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!