1

I want to access a UNC path from my NTLM-enabled WebAPI with the logged-in user's credentials. For that, I'm using the following code:

Using DirectCast(RequestContext.Principal.Identity, System.Security.Principal.WindowsIdentity).Impersonate()
    Dim FileList As String() = IO.Directory.GetFiles("\\file-server\path", "*.xlsm")
End Using

However, this doesn't work.

I still get an access denied when executing that on my server. If I call System.Security.Principal.WindowsIdentity.GetCurrent().Name inside that using block, I get the correct user name, though. Also, if I run the application with the application pool set to my own user identity, it works. But for security reasons, we want to stick with the standard .net pool identity.

Any idea how to make it work?

André R.
  • 427
  • 7
  • 17

0 Answers0