物理路径转网络路径

    /// <summary>
        /// 物理路径转网络路径
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public string urlconvertor(string path)
        {
            string tmpRootDir = HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath.ToString());//获取程序根目录
            string temp = "\\" + path.Replace(tmpRootDir, ""); //转换成相对路径
            temp = temp.Replace(@"\", @"/");
            return temp;
        }

 

posted @ 2017-08-08 20:23  小小高  阅读(229)  评论(0编辑  收藏  举报