Нужно указать не физический адрес директории на пк, а адрес относительно директории проекта. Как это сделать?
public ActionResult ImagesView(string placeName, int? pageNumber)
{
DirectoryInfo directory = new DirectoryInfo(Server.MapPath($"../Content/Images/Photos/{placeName}"));
placeModel model = new placeModel();
model.PlaceName = placeName;
List album = new List();
foreach (var photo in directory.GetFiles())
{
Photo ph = new Photo();
ph.Url = photo.Name;
ph.Place = placeName;
album.Add(ph);
}
if (album.Count() > 6)
{
int PhotosPerPages = 6;
int pages = (int)Math.Ceiling((decimal)album.Count() / PhotosPerPages);
if (pageNumber.Equals(null))
{
pageNumber = 1;
}
var list = new List();
for (int i = (PhotosPerPages * (int)pageNumber - 6); i < (PhotosPerPages * (int)pageNumber)