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

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();
  }

posted @ 2007-01-13 20:26  RobotTech  阅读(613)  评论(0编辑  收藏  举报