./与/与../与~/区别与Server.MapPath()

./当前目录 
/网站主目录 
../上层目录 
~/网站虚拟目录 
如果当前的网站目录为E:\wwwroot 应用程序虚拟目录为E:\wwwroot\company 浏览的页面路径为E:\wwwroot\company\news\show.asp 
在show.asp页面中使用 
Server.MapPath("./") 返回路径为:E:\wwwroot\company\news 
Server.MapPath("/") 返回路径为:E:\wwwroot 
Server.MapPath("../") 返回路径为:E:\wwwroot\company 
Server.MapPath("~/") 返回路径为:E:\wwwroot\company 
server.MapPath(request.ServerVariables("Path_Info")) 


MapPath 方法将指定的相对或虚拟路径映射到服务器上相应的物理目录上。 
语法 
Server.MapPath( Path ) 
posted @   yinghualeihenmei  阅读(579)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· Obsidian + DeepSeek:免费 AI 助力你的知识管理,让你的笔记飞起来!
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示