I have an ASP.Net app in which I am creating a unique user file
when user logs in and then delete this file when user logs out. Also, for each request that user submits during his/her session, this file is updated with some data. The code I am using is as below. All file handling is done using static methods of System.IO.File class, which will always close and dispose file connections automatically.
Each user file is only accessed by a single thread at a time, which leads me to believe that above file handling should be safe for multi-user scenario.
I am worried that when there are many users logged into the ASP.Net app, then this file handling may cause some issues, but not sure.
Question: What could be possible issues with file handling in above scenario in a multi-user scenario, OR it appears safe? There could be large number of users like 500 or more using the ASP.Net app.
//create unique file on login
File.WriteAllText(userFileStoragePath, userData);
//update unique file on every request
File.WriteAllText(userFileStoragePath, userData);
//delete file on log out
File.Delete(userFileStoragePath);