1
I want to know how to create a List<string> with the filenames of a given directory.
The service is hosted on a shared server, published in my httpdocs.
I have several images inside httpdocs/img/imagens.
How do I access this directory?
Code of the Controler:
DirectoryInfo diretorio = new DirectoryInfo("~/img/imagens/");
FileInfo[] arquivos = diretorio.GetFiles();
Error:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
Could not find a part of the path 'C:\Windows\SysWOW64\inetsrv\~\img\imagens'.
</string>
To complete,
Server.MapPathstays insideHttpContext.Current, then always useHttpContext.Current.Server.MapPathor do theusing– Ricardo