简体   繁体   English

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

[英]File.Exists return false despite file is present in WinForm

I want to load an image in imagebox through a url, if the specfic image exists then, that image will be show otherwise a dummy avatar will be shown. 我想通过网址在imagebox中加载图片,如果存在特定图片,则将显示该图片,否则将显示虚拟头像。 For this i am checking the file using this 为此,我正在使用此文件

File.Exists(imagePathComplete)

But the problem is it is always returning false. 但是问题在于它总是返回false。 I check that it can have permission problem. 我检查它可能有权限问题。 So for the soulion i tried alternate solution which is 所以对于灵魂,我尝试了替代解决方案

FileInfo fi = new FileInfo(imagePathComplete); 

But it giving me error 但这给了我错误

System.IO.FileNotFoundException occured in mscorlib.dll but was not not handled in user code . System.IO.FileNotFoundException发生在mscorlib.dll中,但未在用户代码中处理。 . .

使用此UNC格式:

\\192.9.210.122\d$\wamp\esp\img\employee\315079.jpg

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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