简体   繁体   English

C#-使用凭证连接unc路径

[英]C# -Connect unc path with credentials

I have a UNC folder added in my machine using "Add Network Places" option in "My Network Places" (XP). 我在计算机上使用“我的网上邻居”(XP)中的“添加网上邻居”选项添加了UNC文件夹。 I need to select the specific unc folder through my C# "folderBrowser Dialogue." 我需要通过C#“ folderBrowser对话”选择特定的unc文件夹。 However,as unc path is password protected. 但是,由于unc path受密码保护。 While selecting the same,how can I prompt for userCredentials. 选择相同的密码后,如何提示输入userCredentials。 can anyone have thoughts on this... 谁能对此有想法...

PInvoke to WNetAddConnection2 and pass the CONNECT_INTERACTIVE flag to allow the OS to pop a username/password prompt if necessary. P调用WNetAddConnection2并传递CONNECT_INTERACTIVE标志,以允许操作系统在必要时弹出用户名/密码提示。 You can get the PInvoke definition here . 您可以在此处获取PInvoke定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM