【问题标题】:Why Url.Content() not working in ASP.NET MVC 5?为什么 Url.Content() 在 ASP.NET MVC 5 中不起作用?
【发布时间】:2021-09-18 16:16:10
【问题描述】:

当我使用这个标记时:

<img src="~/Content/Images/damvomom.png" alt="header" width="100" height="100" />

显示图像。

但是当我改成这个的时候:

<img scr="@Url.Content("~/Content/Images/damvomom.png")" alt="Images" width="100" height="100" />

它不显示图像。希望大家能帮帮我。

【问题讨论】:

  • 检查呈现的 html。它应该会提示您正在发生的事情以及如何修复路径。
  • 我查了一下,img标签中包含Url.Content()的scr只显示一个字符串(/Content/Images/damvomom.png)而不是Url
  • scr as src 错字?

标签: .net asp.net-mvc


【解决方案1】:

错字:scr=。应该改为src=

【讨论】:

    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-26
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多