获得相对于 当前页面的 根目录路径

public string GetRelativeLevel()
  {
   string[] strArray = HttpContext.Current.Request.Path.Split(new char[]{'/'});
   StringBuilder builder = new StringBuilder(30);
   for(int i=0;i<strArray.Length-3;i++)
   {
    builder.Append("../");
   }
   return builder.ToString();
  }

原文地址:https://www.cnblogs.com/RobotTech/p/619731.html