Directory on another computer - login credentials

My application needs to access files on a remote computer that require a username and password to access it.

I am trying to find out if a directory exists (using Directory.Exists) to check if I can do this.

Is there a way to specify a username and password when working with remote directories? Exists currently returns false.

Greetings

+5
source share
3 answers

Unfortunately no. You will need to wrap your code with additional code in order to handle the impersonation of a user who has access.

, .

+3

LogonUser api , WindowsIdentity.Impersonate.

sample. ( , ..).

+1

MSDN.

, NetUseAdd, , .

+1

All Articles