我的 Controller 返回一个字符串,它是图像的 URL。如何在 asp.net mvc 4 的 View 上显示该 url
我想这是非常简单的事情,但我不知道如何去做。
最佳答案
您没有提供很多细节,但如果您在 Controller 中有图像网址,您应该能够将其设置为模型属性,然后在 View 中使用类似以下内容的内容:
<img src="@Html.Raw(model.ImageUrl)" alt="a description of the image">
使用该 url 来显示图像。是吗?
关于asp.net-mvc-4 - 在asp.net mvc 4中从图像的URL View 中显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35376671/