Link to home
Start Free TrialLog in
Avatar of RakeshBhandari
RakeshBhandariFlag for India

asked on

Can't access file on IIS7 Windows Server 2008 R2

Dear Experts,

My asp.net c# application is hosted on IIS7 running on windows server 2008r2.
in that application i access a file on the server, however, i am getting the following error:
Access to the path 'filename' is denied.

i know i am supposed grant asp.net user on the server access to the folder/file by right-clicking & going to security

but the thing is, when i go to do that, i don't see any asp.net user at all!

can you please guide me about giving permissions so that i can access the file from my web application?
Avatar of Carlos Villegas
Carlos Villegas
Flag of United States of America image

Hi, probably your ASPNET application pool is using the identity "ApplicationPoolIdentity"

You need to grant access to:
IIS AppPool\DefaultAppPool

Open in new window

over the files/folders in the security tab (add this account manually if not appears in the object list).

Also you can try change your ASPNET application pool identity by selecting it from the IIS console and changing its advanced settings, then set the identity to NETWORKSERVICE and grant access to this account over your files.

More info about IIS7 application pool identities on Windows Server 2008 R2:
http://learn.iis.net/page.aspx/624/application-pool-identities/
Avatar of RakeshBhandari

ASKER

i tried this already and hasn't worked for me

is there anything else i can do... or is there a workaround?
Hi, I need more info to be able to give you a solution to your problem.

Please copy this aspx page into your web application folder where is your page that is trying to access the file, then open it from your web browser and post here the displayed info:
Im.aspx

The page just display user authentication info and the windows identity info that is running your page, that will give me enough info to know what action to take.
here's the info :

User

AuthenticationType:
Name:
IsAuthenticated: False
WindowsIdentity

Name: IIS APPPOOL\DefaultAppPool
AuthenticationType: Negotiate
ImpersonationLevel: None
IsAnonymous: False
IsAuthenticated: True
IsGuest: False
IsSystem: False
ASKER CERTIFIED SOLUTION
Avatar of Carlos Villegas
Carlos Villegas
Flag of United States of America 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
Can you do this?

1. Open your folder properties, then go to the security tab, click Edit, click Add:
User generated image2. Select the user, set the permissions, and click OK:
User generated image
Try write the file again from your web application.
i did that already and still i am getting the same error!
well... i rebooted the machine (without making any more changes apart from the one in your screenies) and voila! it works!!

thank you very much!!!
Good! Hehe that this happens in the Windows World ;)
I meant: that THINGS happens in the Windows World ;)