c# Relative Path convert to Absolute Path
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的更多相关文章
- go: GOPATH entry is relative; must be absolute path: "".
安装:vscode-go出现以下提示: go: GOPATH entry is relative; must be absolute path: "".Run 'go help g ...
- obout editor Absolute path for uploaded image
本文转自:https://www.obout.com/editor_new/KnowledgeBase.aspx?id=706 Absolute path for uploaded image Q ...
- Error: setup script specifies an absolute path
在安装sklearn的时候,出现: error: Error: setup script specifies an absolute path: /opt/xgboost-0.47/python-pa ...
- jenkins中配置svn 出现absolute path is not allowed
代码: 兵马未动,粮草先行 作者: 传说中的汽水枪 如有错误,请留言指正,欢迎一起探讨. 转载请注明出处. 想用jenkins作自动化部署tomcat. svn代码已经checkout到本地目录了(/ ...
- learning shell get script absolute path (3)
Shell get script absolute path [Purpose] Get shell script absolute path [Eevironment] ...
- DownLoadManager[20530:228829] DiskImageCache: Could not resolve the absolute path of the old directory.
uiwebview 模拟器打开PDF文件时崩溃.报下面错误,还不知道为什么 DownLoadManager[20530:228829] DiskImageCache: Could not resolv ...
- 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]$ ...
- 安装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 " ...
- os.path.abs()与os.path.realpath()的一点区别
相同点 1. 两者都是返回绝对路径,如果参数path为空,则返回当前文件所在目录的绝对路径 当前py文件所在的目录是revise print(os.path.abspath("") ...
随机推荐
- linux-常用指令2
命令链接符 ...
- stl_hashtable.h
stl_hashtable.h // Filename: stl_hashtable.h // Comment By: 凝霜 // E-mail: mdl2009@vip.qq.com // Blog ...
- luogu1754卡特兰数
卡特兰数 打表 滑稽 #include<iostream> #include<cstdio> #include<algorithm> #include<cst ...
- 【LeetCode】014. Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 题解: 简单的暴力遍历解决 ...
- script加载之defer和async
详情请查看:http://www.heiboard.com/?p=2098
- org.springframework.web.client.HttpClientErrorException: 400 null
异常代码: org.springframework.web.client.HttpClientErrorException: 400 null 已解决. 百度了一下400代表无法解析请求. 说明请求是 ...
- IOS的设计模式
对象创建 原型(Prototype) 使用原型实例指定创建对象的种类,并通过复制这个原型创建新的对象. NSArray *array = [[NSArray alloc] initWithObject ...
- LAMP 1.2 Apache编译安装
1.下载 ...
- Linux查看并修改mysql的编码
系统:阿里云 一.查看mysql字符集 输入:show variables like 'character_set_%'; 二.修改某一个数据库的编码 输入:alter database dbname ...
- 我对PageRank的理解及R语言实现
PageRank,网页排名,又称网页级别.Google左侧排名或佩奇排名,是一种由搜索引擎根据网页之间相互的超链接计算的技术,而作为网页排名的要素之一,以Google公司创办人拉里·佩奇(Larry ...