DirectoryInfo.Exists找不到我映射的网络驱动器C#

时间:2015-10-09 19:18:26

标签: c# asp.net visual-studio

protected void btnAutomaticUpload_Click(object sender, EventArgs e)
{
    DirectoryInfo dir = new DirectoryInfo(@"\\space-bar\UZ\UZ Dept\Management\Data\directory_exists_here\");
    bool atLeastOneSuccessfulUpload = false;
    bool possibleFormatChange = false;

    lblMessages.Text = string.Empty;
    lblResults.Text = "<span style='font-size:large; font-weight:bold'><u>Results Log</u></span><br><br>";

    //If our destination directory does not exist, exit
    if (!dir.Exists)
    {
        lblResults.Text += "<span style='color:Red'>Expected directory does not exist!</span><br>" + dir.FullName;
        return;
    }

所以我一直试图在带有映射网络驱动器的实时服务器上运行此代码,但似乎总是无法找到该文件夹​​。虽然当我在Debug或LocalHost模式下运行它时,它似乎能够找到没有问题的目录。有没有想过为什么即使UNC路径编码也无法正常工作?是否与权限有任何关系?

我正在尝试构建一个自动文件上传解析器。

0 个答案:

没有答案