asp.net-mvc-4 - 如何在 iframe src 中使用 Url.Action

标签 asp.net-mvc-4 iframe url-action

如何使用 Url.Action iframe 中的方法src属性。喜欢

<iframe src = '<%=Url.Action("HelloWorld", "myController");%>' width = "100%" height="1000" frameBorder="0"></iframe>

但它不能正常工作。它说请求的内容不可用。

请帮我

最佳答案

使用 ASP.NET 引擎

<iframe src = '<%: Url.Action("HelloWorld", "myController") %>' width = "100%" 
    height="1000" frameBorder="0"></iframe>

使用 Razor 引擎。
<iframe src = '@Url.Action("HelloWorld", "myController")' width = "100%" 
    height="1000" frameBorder="0"></iframe>

关于asp.net-mvc-4 - 如何在 iframe src 中使用 Url.Action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17675263/

相关文章:

c# - 我如何知道执行更新的 SQL Server 存储过程是否有效?

pdf - 强制 PDF 显示内联,即使 Content-Disposition 另有说明?

javascript - 跨域iframe实时url检测

javascript - 如何在 MVC 4 razor html url 操作中访问 JavaScript 函数的字符串输出?

html - 无法使用图像设置 anchor <a> 的样式

jquery - 将 ASP.NET MVC 4 中的 jQuery 1.8.3 更新为 jQuery 1.9.0

javascript - 未捕获的类型错误 : undefined is not a function

facebook - OAuthWebSecurity Facebook 不祥消息 : app "would like to access your public profile, friend list and email address"

javascript - 用于更新 IFrame 主体的 AngularJS 指令