转相对路径

  #region 轉換相對路勁
        public string Urlconvertor(string imagesurl1)
        {
            string tmpRootDir = Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录
            string imagesurl2 = imagesurl1.Replace(tmpRootDir, ""); //转换成相对路径
            imagesurl2 = imagesurl2.Replace(@"", @"/");
            return imagesurl2;
        }
        #endregion
乐于分享
原文地址:https://www.cnblogs.com/aersliing/p/4202742.html