您当前位置:编程帮手 > 知识 > 知识 > .net逻辑代码 > 待归类 > 内容
代码库
2014-08-03 10:51:23 访问(2487) 赞(0) 踩(0)
/// <summary> /// 如果是网站目录,返回"";如果是虚拟目录(Web),返回 /Web。则图片地址可以写成 GetPhyPath()+"/images/slowx.png" /// </summary> /// <returns></returns> public static string GetPhyPath() { HttpContext hc = HttpContext.Current; if (hc == null) throw new Exception("方法:" + MethodBase.GetCurrentMethod().ReflectedType.FullName + " " + MethodBase.GetCurrentMethod().ToString() + " 发生异常:" + "HttpContext hc = HttpContext.Current 为null"); if (hc.Request.ApplicationPath == "/") return ""; return hc.Request.ApplicationPath; }
上一条:
下一条: