Click here to Skip to main content
15,920,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
In my application we are using IIS 7.0 and windows server 2008.

When i try to access the excell file from the application it gives the below error.

XML
Exception Details: System.UnauthorizedAccessException: Access to the path 'C:\Project\ProjectFolder\Templates\SubBranchDetails.xls' 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) 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.


Don't give suggestions to make file as read and write mode like that. I tried all
Posted

Did you actually try doing what it says in the error message?
"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."
 
Share this answer
 
Comments
RaisKazi 7-Nov-11 5:33am    
5ed. But I think in II7 "Network Services" Account requires the permission. :)
sabbi26 7-Nov-11 5:36am    
Thank u i tried it before for entire folder it's not worked. but now i tried for particular file it's work like charm.
You need to give permissions to that folder
to give permission
Go here
C:\Project\ProjectFolder\Templates\
Right-click the file , choose "Properties" and select the Security tab.
Click "Add" to add the appropriate user or group.
If the file don't contain any secured info then you can give access to everyone.

Highlight the ASP.NET account, and check the boxes for the desired access
 
Share this answer
 
Try the Steps given by Griff. Only you may require to provide permissions to the Account -"Network Services" in II7.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900