C#远程PC文件夹无法在Windows资源管理器打开问题求助
问题:无法通过身份模拟在Windows资源管理器中打开远程文件夹
我需要在Windows文件资源管理器中打开远程PC的文件夹,为此编写了以下C#方法:
private void openComponentFolder_Click(object sender, RoutedEventArgs e) { #region Connexion to the bench ImpersonatedUser iuImpersonatedUser = new ImpersonatedUser(BenchInfos.Current.UserName, "user", BenchInfos.Current.PcPassword); iuImpersonatedUser.LogOn(); #endregion Component component = (sender as MenuItem).DataContext as Component; if (component != null) if (Directory.Exists(component.Path)) Process.Start(component.Path); #region Disconnexion iuImpersonatedUser.LogOut(); iuImpersonatedUser.Dispose(); #endregion }
点击WPF TreeView中的某个Component时,程序会通过远程PC的用户名BenchInfos.Current.UserName、域"user"和密码BenchInfos.Current.PcPassword进行身份模拟登录。如果component.Path对应的路径存在,就尝试在Windows文件资源管理器中打开该文件夹,最后注销远程连接。
但运行该方法时,会弹出“拒绝访问(Accès refusé)”的错误提示(路径确实存在),而在其他方法中,我能够正常读取component.Path文件夹下的文件。
请问:为什么无法在Windows资源管理器中打开该文件夹?该如何解决这个问题?
内容的提问来源于stack exchange,提问作者Remi
相关产品推荐
相关产品推荐

