Link to home
Start Free TrialLog in
Avatar of awilderbeast
awilderbeastFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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?

Thanks
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

Avatar of dj_alik
dj_alik

user impersonate with user that have permissions:
ASP.NET Impersonation
http://msdn.microsoft.com/en-us/library/aa292118(v=vs.71).aspx
ASKER CERTIFIED SOLUTION
Avatar of Dhanasekaran Sengodan
Dhanasekaran Sengodan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of awilderbeast

ASKER

first link got it! thanks