如何在Url.Content中显示图像?

编程入门 行业动态 更新时间:2024-10-23 04:34:24
本文介绍了如何在Url.Content中显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好我的代码中有一些问题首先我要显示目录子目录中的图像 这是我的代码 @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中显示图像?

本文发布于:2023-11-02 08:17:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1551865.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   如何在   Url   Content

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!