asp.net - iframe 未加载 ASP.NET 应用程序中的内容

标签 asp.net html

我有一小段代码,我想加载嵌入在我的一个 aspx 页面中的另一个网站的一部分:

<tr>
   <td style="padding-left:15px;">
      <iframe src="http://www.google.com/" width="210" height="100" /></iframe>
   </td>
</tr>

当我在 IE 中查看页面时,框架有以下警告文本:

To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.

但是,在任何情况下,google.com 或任何其他外部页面都不会加载。 iframe 是一个非常简单的标记...是否明显缺少某些内容,或者 ASP.NET 强加了一些限制?

提前致谢。

最佳答案

阅读警告文字 - 它说的是实话。发布商 (google) 不允许在 iframe 或框架中托管其网站。 Google 通过添加现代浏览器将并且应该遵守的 http header “X-FRAME-OPTIONS: DENY”来实现此目的。

https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header

关于asp.net - iframe 未加载 ASP.NET 应用程序中的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9284841/

相关文章:

c# - 如何根据listitem对arraylist进行排序

asp.net - 未经授权时如何将用户重定向到ASP.NET页?

javascript - 在 ASP.NET 中使用来自 Javascript 的参数调用服务器端函数

javascript - 使用 Javascript 和 WYSIWYG 将内容包装在自定义标签中

jquery - bxslider 控件不工作

php - 表单方法 ="post"阻止了我的元刷新发生

javascript - 为什么我的选择标签在 Firefox 和 IE 中无法正确显示?

html - 修复 ionic 元素标题中的标题对齐

asp.net - MVC ApiController JSON 对象根

asp.net - 如何安全地向所有 ASP.NET AJAX HTTPS 响应添加随机填充?