[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

granting asp.net (network service) account permissions to a file iis7

hi all,

im trying to grant permissions to a pdf on my web server, ive added the network service account to the file give it read/write/modify attrbutes but im still getting the below error

do i need to add the network service account to the folder the file is contained in?
or to anything else?

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.UnauthorizedAccessException: Access to the path 'E:\_documents\YourCV.pdf' is denied. 

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. 

To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

Open in new window

1 Solution
user impersonate with user that have permissions:
ASP.NET Impersonation
try by giving access to network service and IUSR_MACHINENAME) or the authenticated request user to that folder.

and also you can try changing ASP.NET impersonation user to some specific user which has access to that folder or simply for testing add administrator account there by default it will be IUSR, you can see all these settings in Authentication tab.
awilderbeastAuthor Commented:
first link got it! thanks

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now