asp路径问题_解决

Request.ApplicationPath+"/images/a.gif" 如果是站点 就是等于 "//images/a.gif",错误的 
如果有虚拟目录就是 "Webapplication1/images/a.gif" 
没有/的 
Request.ApplicationPath 发挥虚拟目录名称,如果是站点就返回/ 
~/ 类似,不过只用服务端的空间可以识别; 
/  针对目录 
./  当前目录 
../ 相对当前目录的上层目录 
比如你的工程是Webapplication1(url是:http://localhost/webapplication1/webform1.aspx) 
Request.ApplicationPath 就是Webapplication1/ 
~/ 也是 Webapplication1/ 
/就是http://localhost/ 
如果webform1.aspx 下有个文件webform2.aspx 
你可以在webform1.aspx里这样使用 
<a href=webform2.aspx>ddd</a> 
或者 
<a href=/webapplication1/webform2.aspx></a> 
或者 
<a href=../webform2.aspx></a>

posted @ 2016-08-01 15:25  大步向前走  阅读(245)  评论(0)    收藏  举报