Reference:

http://stackoverflow.com/questions/4796254/relative-path-to-absolute-path-in-c

http://stackoverflow.com/questions/1399008/how-to-convert-a-relative-path-to-an-absolute-path-in-a-windows-application

Relative Path => Absolute Path

  var path = Path.Combine(FolderPath, relative);
path = Path.GetFullPath(path);

Absolute => Relative Path

   var fileUri = new Uri(strTargetPath);
var refUri = new Uri(Application.ExecutablePath);
var strRelative = refUri.MakeRelativeUri(fileUri).ToString();
strRelative = Uri.UnescapeDataString(strRelative);

You should use Uri.UnescapteDataString to convert special character such as %23 to “#”.

Here is the reference:

http://stackoverflow.com/questions/575440/url-encoding-using-c-sharp

c# Relative Path convert to Absolute Path的更多相关文章

  1. go: GOPATH entry is relative; must be absolute path: "".

    安装:vscode-go出现以下提示: go: GOPATH entry is relative; must be absolute path: "".Run 'go help g ...

  2. obout editor Absolute path for uploaded image

    本文转自:https://www.obout.com/editor_new/KnowledgeBase.aspx?id=706   Absolute path for uploaded image Q ...

  3. Error: setup script specifies an absolute path

    在安装sklearn的时候,出现: error: Error: setup script specifies an absolute path: /opt/xgboost-0.47/python-pa ...

  4. jenkins中配置svn 出现absolute path is not allowed

    代码: 兵马未动,粮草先行 作者: 传说中的汽水枪 如有错误,请留言指正,欢迎一起探讨. 转载请注明出处. 想用jenkins作自动化部署tomcat. svn代码已经checkout到本地目录了(/ ...

  5. learning shell get script absolute path (3)

    Shell get script absolute path [Purpose]        Get shell script absolute path   [Eevironment]       ...

  6. DownLoadManager[20530:228829] DiskImageCache: Could not resolve the absolute path of the old directory.

    uiwebview 模拟器打开PDF文件时崩溃.报下面错误,还不知道为什么 DownLoadManager[20530:228829] DiskImageCache: Could not resolv ...

  7. linux command line learn - get the absolute path of a file

    get the absolute path of a file in linux readlink -f filenme [heshuai@login01 3_Variation_calling]$ ...

  8. 安装vmware-tools遇the path "" is not valid path to the gcc binary和the path "" is not a valid path to the 3.10.0-327.e17.x86_64 kernel headers问题解决

    #./vmware-install.pl踩点: 1.the path "" is not valid path to the gcc binary 2.the path " ...

  9. os.path.abs()与os.path.realpath()的一点区别

    相同点 1. 两者都是返回绝对路径,如果参数path为空,则返回当前文件所在目录的绝对路径 当前py文件所在的目录是revise print(os.path.abspath("") ...

随机推荐

  1. django实现用户注册、登录、退出

    视图 from django.contrib import auth from django.contrib.auth.models import User from django.views.dec ...

  2. 带SoapHeader验证的WebServices

    一般在项目中,制作的都是基于SOAP协议的webservices,其描述语言是WSDL.但是有时候在项目中,需要保证webservices的安全,需要对其进行进行验证,那么我们就要实现SoapHead ...

  3. 学习c++的优秀博客(转)

    http://zhedahht.blog.163.com/  本博客讨论程序员面试题,并主要集中在C/C++.数据结构算法和算法上.http://saturnman.blog.163.com/ sat ...

  4. Tomcat_异常_02_IOException while loading persisted sessions: java.io.EOFException

    异常原因: EOFException表示输入过程中意外地到达文件尾或流尾的信号,导致从session中获取数据失败. 这是由于tomcat上次非正常关闭时有一些活动session被持久化(表现为一些临 ...

  5. linux命令学习笔记(11):nl命令

    nl命令在linux系统中用来计算文件中行号.nl 可以将输出的文件内容自动的加上行号!其默认的结果与 等等的功能. .命令格式: nl [选项]... [文件]... .命令参数: -b :指定行号 ...

  6. 1147. Heaps (30)

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...

  7. 洛谷【P1175】表达式的转换

    浅谈栈:https://www.cnblogs.com/AKMer/p/10278222.html 题目传送门:https://www.luogu.org/problemnew/show/P1175 ...

  8. VS2008中_T的作用

    引用: VC++里面定义字符串的时候,用_T来保证兼容性.VC++支持ascii和unicode两种字符类型,用_T可以保证从ascii编码类型转换到unicode编码类型的时候,程序不需要修改. 如 ...

  9. HDU1698(线段树入门题)

    Just a Hook Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Descrip ...

  10. Java 的 Tuple 元组数据类型

    元组类型,即 Tuple 常在脚本语言中出现,例如 Scala 的 ("Unmi", "china@qq.com", "blahbla"). ...