我有一个文件夹在我的Web应用程序(ASP.NET MVC 3)中,其中包含一组图像。我想使用foreach循环来遍历文件夹,以获取站点相对路径,然后将其附加到图像标记上。
例如
<div class="slides">
@foreach(string file in ?????)
{
<img src="@file" alt="filename without extension">
}
</div>
我该怎么做?
注意:我的当前foreach循环正在尝试查找物理路径并返回此错误。
Could not find a part of the path 'C:\Content\Images\Photography\Slides\'.