io.file.exists返回false [英] io.file.exists returns false

查看:100
本文介绍了io.file.exists返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用ASP.NET时遇到问题

I''m having a problem with ASP.NET

Dim photoFile As String = Server.UrlEncode(PartInfo.PartNumber.Replace(" ", "_")) & ".jpg"
Dim photoPath As String = "~/partimages/" & photoFile
picbox.Width = New Unit(300)
picbox.Height = New Unit(200)
If IO.File.Exists(Server.MapPath(photoPath)) Then picbox.ImageUrl = photoPath
picbox.ImageUrl = photoPath
PartCat.Text = Server.MapPath(photoPath) & IO.File.Exists(Server.MapPath(photoPath))



当我浏览到上面的网页时,将显示"PartCat"文本框
E:\ INTWeb \ PartsImages \ DE-X1105.jpgFalse

这是服务器文件名,并且IO.File.Exists返回false.但是,该服务器上确实存在具有该路径的文件.如果单击开始"->运行并粘贴",然后单击确定",则会打开照片查看器".

因此服务器路径已正确映射,那么.NET框架为什么返回false?

有什么想法吗?

干杯

如果不带If语句而保留该"picbox.ImageUrl = photoPath",则图像显示



When I browse to the webpage above, the "PartCat" textbox displays
E:\INTWeb\PartsImages\DE-X1105.jpgFalse

Which is the server filename, and IO.File.Exists returning false. However, the file does exist, with that path, on the server. If I click Start->Run and paste that in and click Ok, it opens the Photo Viewer.

So the server path is mapped correctly, so why does the .NET framework return false?

Any ideas?

Cheers

If I leave that "picbox.ImageUrl = photoPath" in without the If statement, the image displays

推荐答案

权限.确保运行该网站的帐户具有权限.
Permissions. Make sure the account running the site has permissions.


这篇关于io.file.exists返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆