0

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?

Ron Harlev
  • 16,227
  • 24
  • 89
  • 132
  • what do you have on this property: System.Security.Principal.WindowsIdentity.GetCurrent().Name? You should have the impersonated userName – Claudio Redi Apr 08 '10 at 23:36

2 Answers2

0

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
  • 57,072
  • 29
  • 149
  • 198
  • mhhh. I don't think it's the case. He has set userName and password on the identity tag. – Claudio Redi Apr 08 '10 at 23:32
  • I do have "anonymous access on". But I have other projects with the same settings that don't have any impersonation issue – Ron Harlev Apr 08 '10 at 23:53
  • 1
    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 Apr 09 '10 at 00:01
0

@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.

Why is <deny users="?" /> included in the following example?

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

Community
  • 1
  • 1
Cyberherbalist
  • 12,061
  • 17
  • 83
  • 121