Building WebApps  «Prev  

Writing to Files for Multiple Users

A key issue related to multiple users/multiple sessions is creating files with a unique name for each user and/or session. You might consider using SessionID, but Session IDs are, as we learned earlier, not necessarily unique. One possible solution would be to use the SessionID combined with some other identifier(s), such as the date and time or an application variable or ID generated from specific user information.
Another issue arises when you attempt to use the same file to store information from different ASP pages, since you may overwrite data in an existing file or attempt to append information to a file that has not yet been created.
You can, however, check to see if a file already exists for the user with the FileExists method. If it does not, you use the CreateTextFile method to create it; if it does, use the OpenTextFile method to open it and append data