简体   繁体   中英

Accessing File system from SharePoint - Access denied

I've created a custom SharePoint application which extends some of the OOTB functionality of SharePoint. Now I want to license the application and provide trial periods etc. So I want to store the licensing information in the file system/registry and check the validity of the license across the application. But even after I elevate to the application pool identity (who is just a domain user and not a system administrator as advised here http://technet.microsoft.com/en-us/library/cc678863%28office.12%29.aspx ) I'm getting access denied for accessing my file.

What is the common practice to read/write/create files in the file system from SharePoint application?

Have you checked thet security logs to see which user is being denied access. I am pretty sure it will be the user who is logged into sharepoint rather than the app pool identity that is trying to access the file. The app poolidentity is usually only used in this way if the web site is using anonymous authentication.

Are you using SharePoint 2010 or 2007? What kind of Authentication? NTLM, Forms or Claims based?

If application is running under NTLM, then as Ben suggested, application will run under NTLM account and you should be able to access the resource.

If running under forms the application will run as anonymous user (local account), which will fail to access the shared resource.

I would suggest using ProcMon, it will capture the underlying access denied error and what user is being used to access that.

I guess there is no other solution apart from storing it in a custom database or a custom folder which is configured with full access for the application pool account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM