您好我的代码中有一些问题首先我要显示目录子目录中的图像 这是我的代码 @foreach(Directory.GetDirectories中的字符串折叠(Server.MapPath(〜/ Content / Uploads))) { string folder = fold.Substring( fold.LastIndexOf(\\)+ 1); string path =〜/ Content / Uploads /; 字符串路径= Path.Combine(路径,文件夹); string [] fo = Directory.GetFiles(Server.MapPath(路径)); foreach(字符串表示) { img src =@ Url .Content(fol)width =20%/> } } 但是当我运行应用程序时 输出是一个文本 输出 c:\ usersrs \ brian \documents\visual studio 2012 \Projects\ImagesSample\ImagesSample\Content\ Up loads\Brochure 1 \ Brochure 1.png 而不是图片? 你能帮帮我吗? 先谢谢!
Hello I Have some Issues in my code First I want to display the images from the subdirectory of a directory this is my code @foreach (string fold in Directory.GetDirectories(Server.MapPath("~/Content/Uploads"))) { string folder = fold.Substring(fold.LastIndexOf("\\")+1); string path = "~/Content/Uploads/"; string paths = Path.Combine(path, folder); string[] fo = Directory.GetFiles(Server.MapPath(paths)); foreach (string fol in fo) { img src ="@Url.Content(fol)" width="20%"/> } } but when I run The Application The Output is a text Output c:\users\brian\documents\visual studio 2012\Projects\ImagesSample\ImagesSample\Content\Uploads\Brochure 1\Brochure 1.png instead of a Images? Can you help Me Out here? Thanks In advance!
推荐答案这篇文章可以帮到你 - MVC。返回在控制器中动态绘制的图像。 [ ^ ]。 This post could help you - MVC. Return image dynamically drawn in controller.[^].
更多推荐
如何在Url.Content中显示图像?
发布评论