访问共享文件夹(被保护) [英] Access a shared folder(which is protected)
问题描述
我需要编写一个C#脚本可以访问的安全共享位置(HV我的用户名和密码),以从该位置在那边务实访问一些文件,并转储一些文件帮助。
预先感谢您
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
推荐答案
要访问被保护的,你需要调用LogonUser并做内模拟网络共享你的申请。该 MSDN文章提供代码示例。然后,你可以浏览,复制/移动等与System.IO命名空间。例如:
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.
这篇关于访问共享文件夹(被保护)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!