Directory.Exists在网络驱动器上返回False [英] Directory.Exists Returning False on Network Drive

查看:285
本文介绍了Directory.Exists在网络驱动器上返回False的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码,基本上执行Directory.Exists.无论是网络共享,UNC还是本地驱动器,它在许多站点上都能正常工作,但是我有一个客户端,对于网络共享和UNC共享,它总是返回false.我是 完全出于想法并寻找一些想法.

如果Directory.Exists(txtWebReportingPath.Text)= True,那么
            ExecCmd(cmdLine,True,0,False,txtWebReportingPath.Text)
        如果结束

我也有代码尝试将FolderBrowseDialog .SelectedPath设置为同一目录,并且也会失败.

在Windows资源管理器中查看驱动器时,我们可以将其作为网络共享和UNC路径进行访问,但是无论出于何种原因,应用程序根本看不到它.  

这是Windows应用程序,如果有任何不同,则不是服务.

感谢您的任何想法

罗德尼


解决方案

仅用于测试,您可以枚举引起麻烦的父目录中的目录,以确保该目录出现在其中吗?

您是否尝试过最小程序来找出是否存在相同的问题?难道当您通过Windows资源管理器查看它时,资源管理器已保存了一些凭据以使其能够访问该目录吗?

-
安德鲁


I have the following code which basically does a Directory.Exists. It is working fine at many sites whether it be a network share, UNC or local drive, but I have one client where it is always returning false for a network share and a UNC share as well. I'm totally out of ideas and looking for some thoughts.

        If Directory.Exists(txtWebReportingPath.Text) = True Then
            ExecCmd(cmdLine, True, 0, False, txtWebReportingPath.Text)
        End If

I also have code trying to set the FolderBrowseDialog .SelectedPath to the same directory and that fails as well. 

When we look at the drive in Windows Explorer we can access it both as a network share and a UNC path, but for whatever reason my application just doesn't see it at all.  

This is a Windows application, not a service if that would make any difference.

Thanks for any thoughts 

Rodney


解决方案

Just for testing, can you enumerate the directories in the parent directory of the one causing trouble, to make sure it appears there?

Have you tried a minimal program to find out if that has the same problem? Could it be that when you view it through Windows Explorer that Explorer has some credentials saved which enable it to access the directory?

--
Andrew


这篇关于Directory.Exists在网络驱动器上返回False的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆