【发布时间】:2020-04-21 17:41:23
【问题描述】:
我试图从一个 ASP.NET MVC 应用程序连接两个路径,一个远程服务器路径和一个从数据库中提取的路径。我在下面表演:
string serverPath = @"\\myServer\TempFolder";
string filePath = GetPathFromDatabaseTable();
string finalPath = System.IO.Path.Combine(serverPath, filePath);
GetPathFromDatabaseTable 方法返回这个字符串:
\\path\\to\\file.pdf
使用 Path.Combine 连接时,进入 finalPath 的结果是:
\\path\\to\\file.pdf
所以前缀 serverPath \myServer\TempFolder 被删除。为什么会这样?
【问题讨论】:
标签: c# asp.net-mvc visual-studio-2013 path-combine