我正在使用aejw API在C#中创建桌面应用程序。然后,我必须使用存储的身份验证来映射持久的网络驱动器连接。
我使用的示例代码无效。代码映射成功共享,但是没有在Credential Manager中存储密码。可以使用'Runtime.InteropServices'达到我想要的效果(存储密码)
NetworkDrive nd = new NetworkDrive();
nd.LocalDrive = "Y:";
nd.Persistent = true;
nd.SaveCredentials = true;
nd.ShareName = @"\\server\share";
nd.MapDrive(username,password);