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

Access to the path is denied

5 Answers 623 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 04 Sep 2013, 09:59 PM
Hi

In sharepoint 2010 I have a webpart with an AsyncUpload.

If I upload a file  on a local folder everything is fine, If I try to upload on a shared folder on another server I get: "Access to the path is denied".

The application pool user under the site is running has access to that folder as well as the domain user logged in to the sharepoint. I added even "everybody" with Read/Write permission on that shared folder and still the same error.

The users are all Active Directory authenticated.
I added all the AD users under the SharePoint is running and still the same error.

Under what user .SaveAs(path) is running because for sure is not the same user as the one returned by "System.Security.Principal.WindowsIdentity.GetCurrent().Name"?

Any thoughts what permission should I add to the shared folder ?

Regards,
Hans

5 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 09 Sep 2013, 12:07 PM
Hello Hans,

 
Thank you for contacting Telerik support.

Basically the reason that is causing such error is most probably connected the rights of the Target and the temporary folders. That is why I will recommend you to add full rights control to the default temporary and target folder ("~App_Data/RadUploadTemp"), and assigned full control rights to the application pool account and the network service. Please try this with and without UseApplicationPoolImpersonation property and let us know if it helped. You can also try giving the IUSR full rights to the Upload directory.

Hope this will help you solve the issue. If you have further questions please don't hesitate to contact us again.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Sean
Top achievements
Rank 2
answered on 25 Nov 2013, 09:06 PM
I am having the same issue, but in my control I set the target folder to something other than default. But I am now getting the access denied error.

Thoughts?

Sean~
0
Plamen
Telerik team
answered on 27 Nov 2013, 10:48 AM
Hi Sean,

Scenarios in which such error is observed are most probably connected with the rights of the folders where are saved the files. In such case I would also recommend you to make sure that the you have added full rights control to the folder you have set as TargetFolder.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Hans
Top achievements
Rank 1
answered on 27 Nov 2013, 03:14 PM
If your control is in a SharePoint web part you need to run something like this:

SPSite site = SPContext.Current.Site;

SPWeb web = SPContext.Current.Web;

SPSecurity.RunWithElevatedPrivileges(delegate()

{

using (SPSite ElevatedSite = new SPSite(site.ID))

{

using (SPWeb ElevatedWeb = ElevatedSite.OpenWeb(web.ID))

{

string path = Path.Combine(basePath, NewFileName);

file.SaveAs(path);

}

}

});

Despite of what Telerik people said, I couldn't make it run without elevated privileges.And on the target folder , the user under the application run (application pool user) should have read/write permissions on that folder.

Regards,
Mihai

 

 

0
Plamen
Telerik team
answered on 02 Dec 2013, 01:57 PM
Hello,

Thank you for sharing the code that worked in you case and for you concern with RadControls.

Regards,
Plamen
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AsyncUpload
Asked by
Hans
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Sean
Top achievements
Rank 2
Hans
Top achievements
Rank 1
Share this question
or