Occasional "Unable to Write To Folder" error message

  •  08-25-2009, 3:23 PM

    Occasional "Unable to Write To Folder" error message

    We are occasionally (very small percentage of the time) getting the error"Unable to write to folder: {path}.  Please change the permissions of this folder or specify a temporary folder using TempDirectory property or setting temporary file location in web.config." where {path} is the path to the upload folder specified in the web.config.  Let me reiterate that uploading works in the majority of cases.  However we do see on a regular occurrence the error.

    Using the Sysinternals FileMon utility to monitor the folder during the upload process I see that when uploading a file, it appears that the file "TempPathTest.txt" is written, and deleted.   I believe that this is a crude test of directory permissions.  What I am speculating is that when activity gets high on our servers, two people may attempt to upload at the same time.  In this condition, I speculate that the one user is successful in creating this temp file, while the other gets an error either creating or deleting the file. 
     
    If my speculations are correct, I believe that this code will need to be updated such that each attempt to validate the directory permissions by the control within a thread utilize some random file name to make this a multi-thread-safe operation -- possibly by appending a GUID to the end of the TempPathTest file like the uploading and persisted file name patterns.
     
    Please confirm or correct my speculations.
     
    Thanks for your attention to this.
     
     
     
View Complete Thread