Directory.Exists not working for a network path

后端 未结 4 1685
春和景丽
春和景丽 2020-12-10 11:02

I have a line of code checking if a directory exists and then getting the list of files in it.

System.IO.Directory.Exists(@\"\\\\Server\\Folder\\\");
         


        
4条回答
  •  有刺的猬
    2020-12-10 11:12

    I was was getting this error with code a UNC that looked like this:

    @"\Server01\c$\Data\SubFolder"

    I made an explicit share and got rid of the c$ and made it look like this:

    @"\Server01\TheData\SubFolder"

    and it started to work.

    I am not 100% sure that is what fixed the permissions problem, but it started to work immediately after making that change.

提交回复
热议问题