码迷,mamicode.com
首页 > 其他好文 > 详细

物理路径转网络路径

时间:2017-08-08 21:40:23      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:style   根目录   ram   returns   程序   tor   convert   ret   log   

    /// <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;
        }

 

物理路径转网络路径

标签:style   根目录   ram   returns   程序   tor   convert   ret   log   

原文地址:http://www.cnblogs.com/gaocong/p/7308796.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!