C
C#2y ago
DeeJayh

Copying files from network path (c, .net)

File.Copy cannot access the network share because it doesn't have the same access as the user running it. Impersonating a domain user given access works to see/obtain the files, but then doesn't have access to the user's/system's folders. I could mitigate that by going to each computer and giving that domain user access to a folder on the drive, and there may even be some easy AD way to do that I'm not aware of, but currently the solution is escaping me here and I could use some input. Thanks in advance!
1 Reply
DeeJayh
DeeJayh2y ago
I went with a solution of using Mpr.dll's WNetUseConnection and WNetCancelConnection to give access to the share. Wish this was something convenient in .NET framework, but no big deal.