views:

70

answers:

2

I have my ASP.NET web.config set with impersonation

<identity impersonate="true" userName="domainName\userName" password="userPassword" />

I'm running some a method like

IO.Directory.GetFiles(somePath)

And monitoring the file system access with Process Monitor
I keep getting all the access requests from the aspnet_wp.exe process to the folder, as the ASPNET user.
Why am I not seeing the access as the impersonated user?

A: 

My guess is you have anonymous access on ?

As a result it will use the system account... see

Disable anonymous access, and it will use the impersonation account.

Nix
mhhh. I don't think it's the case. He has set userName and password on the identity tag.
Claudio Redi
that doesn't mean anything.... this is a hosting thing.
Nix
I do have "anonymous access on". But I have other projects with the same settings that don't have any impersonation issue
Ron Harlev
@Nix: Not sure what you mean with hosting thing. But here you have the reference for impersonation. What happens with each possible option. http://msdn.microsoft.com/en-us/library/aa292118%28VS.71%29.aspx. And if the site was public, how do you expect the users to access to it with no anonymous access??
Claudio Redi
A: 

@Nix's answer sounds like it might fit the ticket, but you should also check your authorizations in the .config file to make sure they're not conflicting with your impersonation in some way. Have a look at this question for a brief discussion on the subject of grant/deny, and the link in the accepted answer with more info.

http://stackoverflow.com/questions/831994/why-is-deny-users-included-in-the-following-example/832056#832056

BTW, I have not had conflicts with impersonations and leaving anonymous access on before, so ...

Cyberherbalist