VB.Net File.Copy / File.Move与不同的凭据凭据、不同、Net、VB

2023-09-04 03:18:46 作者:最有个性的昵称大全

在理想情况下,我想能够到本地驱动器,而我没有权限访问网络共享上访问的文件夹之间复制/移动(但应用程序会)。

Ideally I'd like to be able to copy/move between an accessible folder on my local drive and a network share that I don't have permission to access (but the application would).

我使用的模拟给我访问的文件在网络共享,但使用System.IO File.Move或File.Copy迫使我使用相同的凭据为每个位置。有没有解决的办法吗?

I am using impersonation to give me access to the files in the network share but using System.IO File.Move or File.Copy forces me to use the same credentials for each location. Is there a way around this?

推荐答案

我相信你可以做的就是这样的事情。

What I believe you could do is something like this.

请的模拟,让文件的选择。将文件复制到该应用程序可以得到一个位置 停止模拟,然后让应用程序从临时位置复制文件到期望的最终结果。

我们已经在我们的应用程序之前做到了这一点,它不是优雅,但它完美!

We have done this before in our applications, it isn't elegant, but it works perfectly!