简体   繁体   中英

System.IO.Directory.Exists returns false when directory exists

The following code throws an exception preventing a website from displaying:

        if (!System.IO.Directory.Exists(newPath))
        {
            throw new System.IO.DirectoryNotFoundException();
        }

The newPath variable is a string of the format \\\\IPADDR\\QA\\FileAttachments.

The directory can be accessed in either Windows Explorer or Windows PowerShell (running as administrator).

I suspect it is a permissions or security problem, how can I check this?

What are the other possible problems that could generate an fake false?

This code works on another server accessing the exact same folder.

Edit - corrected the string format.

As Dour High Arch pointed out this is probably a duplicate of this question. .

The problem was solved by changing the application pool user to be the administrator of the server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM