I suspect the problem is with the use of Path.GetTempFileName
followed by File.Move
. When the uploaded file is saved to tempFilename
, the temporary file gets whatever permissions are assigned to the temporary folder. Moving the file preserves those permissions as is instead of recalculating the inheritable permissions based on the destination.
Instead of File.Move
, try using File.Copy
followed by File.Delete
:
//File.Move(tempFilename, destinationFilename);
File.Copy(tempFilename, destinationFilename);
File.Delete(tempFilename);