尽管WinForm中存在文件,但File.Exists返回false

时间:2018-10-17 05:42:34

标签: c# winforms

我想通过URL将图像加载到imagebox中,如果存在特定图像,则将显示该图像,否则将显示一个虚拟化身。为此,我正在使用此文件进行检查

File.Exists(imagePathComplete)

但是问题是它总是返回false。我检查它可能有权限问题。所以对于灵魂乐,我尝试了另一种解决方案

FileInfo fi = new FileInfo(imagePathComplete); 

但这给了我错误

  

System.IO.FileNotFoundException发生在mscorlib.dll中,但不是   未在用户代码中处理。 。 。

1 个答案:

答案 0 :(得分:1)

使用此UNC格式:

\\192.9.210.122\d$\wamp\esp\img\employee\315079.jpg
相关问题