peterg2000
New member
- Joined
- Nov 18, 2021
- Messages
- 4
- Programming Experience
- 3-5
Hi ,
I need to list and access files on an UNC drive. (shared drive such as \\remoteserver\directoryx\)
This correctly lists all the directories using the drive letter but I need to use the \\remoteserver\directoryx\ format as drive letters are different on each computer.
I get drive not found error with the UNC.
Any suggestions.
This is under ASP.NET core mvc 5.0
I need to list and access files on an UNC drive. (shared drive such as \\remoteserver\directoryx\)
List directories:
public IActionResult Index()
{
string[] filepaths = Directory.GetDirectories(Path.GetFullPath("J:\\"));
//Server.MapPath("~/UploadedFiles")
List<FileViewModel> lstFiles = new List<FileViewModel>();
foreach (var file in filepaths)
{
lstFiles.Add(new FileViewModel { FileName = Path.GetFileName(file) });
}
return View(lstFiles);
}
This correctly lists all the directories using the drive letter but I need to use the \\remoteserver\directoryx\ format as drive letters are different on each computer.
I get drive not found error with the UNC.
Any suggestions.
This is under ASP.NET core mvc 5.0