日期:2014-05-17  浏览次数:20377 次

Request.ApplicationPath
<img src="<%=(Request.ApplicationPath == "/" ? "" : Request.ApplicationPath)+"/"+this.ResourceManager.GetString("IMG_C_IMG1") %>" />
请各位高手帮忙解释下这个<img/>标签的意思
谢谢!

------解决方案--------------------
1、Request.ApplicationPath是服务器虚拟目录的根路径
2、this.ResourceManager.GetString("IMG_C_IMG1")应该是读配置文件(web.config)里IMG_C_IMG1值,目测应该是一个图片相对路径
3、? "" : 是三元运算符,(Request.ApplicationPath == "/" ? "" : Request.ApplicationPath相当于
string str="";
if(Request.ApplicationPath == "/")
   str="";
else
   str=Request.ApplicationPath == "/";
然后用str和配置文件里的图片相对路径组合成一个完整的图片相对路径