在Web Server中托管时File.Exist(path)问题 [英] File.Exist(path) Issues while hosting in web Server

查看:79
本文介绍了在Web Server中托管时File.Exist(path)问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

Asp.net应用程序正在使用File.Exist(Path),当在Web服务器"File.Exist(path)"中发布时,本地工作正常,此方法始终仅返回false(即使文件存在)... .wt是我不认识任何专家的原因,请尽快告诉我,它非常紧急的COZ发布的服务器是实时服务器.


提前祝愿!!!!!!你的摇滚!!!!!!
Ramesh Muthaiah

hi Friends,

Asp.net appln i''m using File.Exist(Path) it''s local working fine when published in web server "File.Exist(path)" this maethod always return false (even if file exist) only....wt''s the reason i dont''t know anybody expert on this pls let me know asap it''s very urgent coz published server is live server.


Advance Wishes!!!!!!ur rock!!!!!!
Ramesh Muthaiah

推荐答案

尝试使用
Server.MapPath("your path here")



此处 [ MSDN链接 [



Have a look at this article here[^].

MSDN link[^]

Good luck,
OI


尝试一下.

Try this.

string FilePath = Request.PhysicalApplicationPath + "FileName.txt"; 



Request.PhysicalApplicationPath将为您提供虚拟目录的绝对路径.

有关更多信息:
http://asp-net-example.blogspot.in/2009/01/how-to-check-whether-file-exists-or-not.html [



Request.PhysicalApplicationPath will give you the virtual directory''s absolute path.

For more info: http://asp-net-example.blogspot.in/2009/01/how-to-check-whether-file-exists-or-not.html[^]


授予IIS USER完全权限,这将有所帮助
Give Full permission to IIS USER it will help


这篇关于在Web Server中托管时File.Exist(path)问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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