This is a migrated thread and some comments may be shown as answers.

Async and NTFS Permissions in Temp Directory

1 Answer 77 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 12 Nov 2014, 05:03 PM
I ran into an issue where an FTP user could not access files uploaded from a radasyncupload control.  The user had permissions to the target directory.  Files added to the directory inherited the permissions of the directory when except when uploaded asynchronously. 

Here’s what I found.  In a part of my application I’m Telerik RadFileUpload instead of the standard asp file upload control. 

Because Telerik RadFileupload is asynchronous, it first uploads the file to a temporary directory (/RadUploadTemp).  Once fully
uploaded, it then automatically moves it to the target directory (/TargetDirectory/…)
 
Here is the problem.  As the file is being moved it takes the permissions associated the temporary directory with it. Since the fpt account had no permissions in the RadUploadTemp directory, it assigns no permissions to the file when moved to the TargetDirectory .

In order to resolve this, I gave read permissions the ftp account in the RadUploadTemp directory and now it copies the files with the permissions.

While the link below does not address the rad control specifically, it lead me to the answer.  In my case, I had to apply permissions to the temp directory.

http://stackoverflow.com/questions/23136723/why-are-permissions-wonky-when-my-iis-worker-saves-a-file-in-asp-net

Is this something Tererik could fix in a way similarly stated in the article?:

"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"

Hope this helps somebody else. 



1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 17 Nov 2014, 03:44 PM
Hi Robert,

Thank you for sharing this with the community.

You are right the RadAsyncUpload will move uploaded files on postback, but this can be changed. It is possible to read and save the file stream manually. Also you can change the Temporary Folder to a folder that your FTP user has permissions. AsyncUpload has a UseApplicationPoolImpersonation, which defines whether to use application pool impersonation.
http://msdn.microsoft.com/en-us/library/134ec8tc%28v=vs.100%29.aspx

The problem is confrontational and cannot resolve it.

Regards,
Hristo Valyavicharski
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
AsyncUpload
Asked by
Robert
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or