`
yuyangsoft
  • 浏览: 36638 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

获取指定文件路径

阅读更多
string path=HttpContext.Current.Server.MapPath("FileName")

FileName可以是文件名称,也可以是文件夹名称!

如果是文件名("aa.aspx") 例如:path="c:\\test\\aa.aspx";

如果是文件夹("file") 例如:path="c:\\text\\file";

string path=System.Web.HttpContext.Current.Request.Path;

path获取出来直接就是当前文件的完整路径,包括文件名及后缀!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics