怎么在服务中对网络共享进行身份验证???在线等
怎么在服务中对网络共享进行身份验证???
directoryInfo = New DirectoryInfo(FolderPath) 'FolderPath映射盘网络驱动器路径
directoryInfo.Exists()
[解决办法]
System.Security.Principal.WindowsIdentity p = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal wp = new System.Security.Principal.WindowsPrincipal(p);
bool IsAdmins = wp.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator);//判定
[解决办法]
调一下net use先,directoryinfo连接共享目录会用当前登陆用户的身份去连接。