简体   繁体   English

使用带凭证的UNC路径

[英]Using UNC path with credentials

I'm working on an app that uses an UNC path to access remote files in the same LAN. 我正在开发一个使用UNC路径访问同一LAN中的远程文件的应用程序。 The problem is that when access is attempted it throws an exception related to Windows credentials. 问题是,当尝试访问时,它会抛出与Windows凭据相关的异常。

Is there a way to add credentials to my UNC path? 有没有办法将凭证添加到我的UNC路径?

Thank you 谢谢

It might be useful for you to use the NetUseAdd function from the windows api http://msdn.microsoft.com/en-us/library/windows/desktop/aa370645(v=vs.85).aspx . 您可以使用windows api中的NetUseAdd函数http://msdn.microsoft.com/en-us/library/windows/desktop/aa370645(v=vs.85).aspx It allows you to access a directory through its UNC path. 它允许您通过其UNC路径访问目录。

Looks like Win32 APIs are the most common way to handle this. 看起来Win32 API是处理此问题的最常用方法。 Check out this SO post Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials 查看此SO帖子从具有凭据的远程非受信任域访问共享文件(UNC)

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

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