question

RajNair avatar image
0 Votes"
RajNair asked

Access shared network folder using credentials

I am trying to access a network drive from code using credentials. I tried to use the following code, it seems to be not working


         NetworkCredential theNetworkCredential = new NetworkCredential(equipment.User, equipment.Password);
         CredentialCache theNetCache = new CredentialCache();
         theNetCache.Add(new Uri(equipment.SourceFolder), "Basic", theNetworkCredential);

         string[] theFiles = Directory.GetFiles(equipment.SourceFolder);

Is there any way we can access it with other machines account (folder is shared from this machine).

windows-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers