我在提供 IFrame src 的路径时遇到问题。

我已经将我的 html 文件保存在同一个目录中。但我仍然没有得到它

我是这样写的:

  <iframe id="iframe" frameborder="0" src="Dancing.htm" style="width: 100%; height: 700px;"></iframe>

但是它给了我一个错误,因为找不到资源但是如果我写一个 View (.cshtml)页面而不是 HTM 页面它被正确加载我不会理解为什么会发生这种情况

请帮我。

最佳答案

您必须从 Views 文件夹中找到您的 *.html 文件。

创建 HTML 文件夹并将 Dancing.htm 文件复制到该文件夹

/HTML/Dancing.htm
<iframe id="iframe" frameborder="0" src="@Url.Content("~/HTML/Dancing.htm")" style="width: 100%; height: 700px;"></iframe>

关于asp.net-mvc-3 - 如何在MVC3中为iframe的src属性提供html文件的路径,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10292297/

10-12 12:45
查看更多