Search code examples
c#network-programmingfilesystemsdirectory

Directory on another machine - Login credentials


My application needs to access files on a remote machine that requires a username and password for accessing it.

I'm trying to find out if a directory exists (using Directory.Exists) to verify I can make the 'connection.

Is there a way to supply the username and password when working with remote directories? Currently Exists returns false.

Cheers,


Solution

  • Unfortunately not. You will need to wrap your code using extra code to handle impersonation of a user that does have access.

    This article explains how to do it in code further down the page.