程序如下:
File.Copy(@"//192.168.0.100/aa/1.txt", @"E:\1.txt", true);
File.Copy(@"C:/1.txt", @"D:\1.txt", true);拷远程的不成功,拷本地的可以
192.168.0.100/aa 可以访问,而且1.txt我也设置成了everyone是不是还写少了什么?登陆的账号密码验证要写在程序里?
File.Copy(@"//192.168.0.100/aa/1.txt", @"E:\1.txt", true);
File.Copy(@"C:/1.txt", @"D:\1.txt", true);拷远程的不成功,拷本地的可以
192.168.0.100/aa 可以访问,而且1.txt我也设置成了everyone是不是还写少了什么?登陆的账号密码验证要写在程序里?
api WNetAddConnection2A
参考
http://www.rhyous.com/2011/08/07/how-to-authenticate-and-access-the-registry-remotely-using-c/
要注意源文件共享,并且everyone都有read的权限
用uploadFile.SaveAs(filePath)可以繞過這些