![](/img/trans.png)
[英]StreamReader Server.MapPath - Physical path given, virtual path expected
[英]Server.MapPath - Physical path given, virtual path expected
我正在使用這行代碼:
var files = Directory.GetFiles(Server.MapPath("E:\\ftproot\\sales"));
找到文件夾中的文件,但我收到錯誤消息說
“物理路徑給定但預期虛擬路徑”。
我在C#中使用System.IO是否足夠新,所以我想知道是否可以輸入物理路徑來執行此操作?
如果您已經知道您的文件夾是: E:\\ ftproot \\ sales那么您不需要使用Server.MapPath,如果您只有〜/ folder / folder1之類的相對虛擬路徑並且您想知道磁盤中的真實路徑......
var files = Directory.GetFiles(@"E:\ftproot\sales");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.