0
我想要获取绝对路径并在浏览器控件中运行本地HTML文件。绝对路径字符串具有破坏URL的字符
string exeFile = (new System.Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath;
string exeDir = Path.GetDirectoryName(exeFile);
string fullPath = Path.Combine(exeDir, "HTML\\index.html");
this.webBrowser1.Url = new System.Uri(fullPath, System.UriKind.Absolute);
这是行不通的,因为完整路径最终被:
C:\用户\ tunnelld2 \文档\ Visual%20studio%202012 \项目\ qTab2 \ qTab2 \ BIN \调试\ HTML \指标.html
我已检查多次,路径正确。这个问题似乎是这样的:
视觉%20studio%202012
如果我手动使用字符串:“C:\用户\ tunnelld2 \文件\的Visual Studio 2012 \项目\ qTab2 \ qTab2 \ BIN \调试\ HTML \ index.html“
它工作正常。如何从我的字符串中删除%20,以便我可以呈现HTML页面