Server.MapPath - Physical path given, virtual path expected
I'm using this line of code:
var files = Directory.GetFiles(Server.MapPath("E:\\ftproot\\sales"));
to locate files in a folder however I get the error message saying that
"Physical Path given but virtual path expected".
Am new enough to using System.IO in C# so I was wondering if it's possible to enter a physical path to do this?
Solution 1:
if you already know your folder is: E:\ftproot\sales then you do not need to use Server.MapPath, this last one is needed if you only have a relative virtual path like ~/folder/folder1 and you want to know the real path in the disk...
Solution 2:
var files = Directory.GetFiles(@"E:\ftproot\sales");