I need help in writing a C# script which can access a secured shared location(i hv the username and password) in order to access some files from that location and also dump some files over there pragmatically. Thank you in advance
To access a network share that is protected you need to call LogonUser and do impersonation within your application. The MSDN article provides a code sample. Then you can just browse, copy/move, etc with the System.IO namespace. For instance:
System.IO.Directory.GetFolders(@"\\Server\Share");
will return a list of the folders on the network share.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With