html - 在 <img> 的 src 中调用 Controller Action

标签 html asp.net-mvc image

在我的 cshtml 页面中我有 <img src="/controllerName/actionName" />这在我测试时非常有效.. 但是一旦我发布 img被打破。发布时如何保留图像?我在图像的 src 中调用的操作返回 return File(key.ToWebImage().GetBytes(), "image/jpeg");

有没有其他方法可以让图像在发布时保留下来?

感谢任何帮助。

最佳答案

我想通了。我只需要:

<img src='@Url.Action("actionName", "controllerName") />

关于html - 在 <img> 的 src 中调用 Controller Action ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35947719/

相关文章:

html - 应用于特定 DIV 的 CSS 会遗漏一些细节

javascript - 在整个 html 页面上等待光标

c# - 返回 View 后未调用 ASP.NET 索引方法

javascript - 将值设置为 Html.HiddenField 提交表单后不绑定(bind)到模型

css - 来自带有django的静态文件的css样式的背景图像

java - 如何使用 java 从 Microsoft 文档创建预览图像

html - 仅在移动设备中控制 Bootstrap 行顺序

html - 当存在 iOS 7 虚拟键盘时,Div 元素不会停留在底部

javascript - 如何使用 Jquery 从 "li "的属性中获取值?

html - 位置 : absolute bottom: 0 not working when centering text on image