string TopluYuklemeKlasor="/dosyalar/resimler/";
List<string> resimler = GetImageFolder(TopluYuklemeKlasor);
//liste tipinde resim yolları döndürür
public static List<string> GetImageFolder(string FolderPath)
{
List<string> imagesList = new List<string>();
try
{
var files = Directory.GetFiles(HttpContext.Current.Server.MapPath(FolderPath));
for (int i = 0; i < files.Length; i++)
{
try
{
var img = new WebImage(files[i]);
imagesList.Add(FolderPath + img.FileName.Split('\\').LastOrDefault());
}
catch { }
}
}
catch { }
return imagesList.OrderBy(x => x).ToList();
}