【问题标题】:How to embed an entire azure web site into a WordPress site如何将整个 azure 网站嵌入 WordPress 网站
【发布时间】:2021-04-13 05:26:25
【问题描述】:

我正在尝试将整个 azure 网站嵌入到 wordpress 网站中。以下作品:

 <iframe src="https://tvirusly.azurewebsites.net" height="1200" width="1600" title="Covid Risk Calculator"></iframe>

但是当我点击上述网站或使用以下脚本时,它不起作用:

<iframe src="https://tvirusly.azurewebsites.net/AnonymousEvents/Create" height="1200" width="1600" title="Covid Risk Calculator"></iframe>

我收到 tvirusly.azurewebsites.net 拒绝连接的错误。

提前感谢您的帮助。

【问题讨论】:

    标签: asp.net wordpress azure


    【解决方案1】:

    发生这种情况是因为 URL https://tvirusly.azurewebsites.net/AnonymousEvents/Create 发送了 X-Frame-Options: SAMEORIGIN 标头。它会阻止网站被包含在 iFrame 中。

    如果你可以访问 tvirusly.azurewebsites.net 的源代码,那么你可以看到这个解决方案:Windows Azure iframe domain provider = issue with X-Frame-Options

    您基本上将X-FRAME-OPTIONS 设置为一个空字符串。

    如果你不能改变来源,那你就倒霉了。

    【讨论】:

    • 感谢 Roman 提供的链接。该特定解决方案假定 App.cs。我将如何为没有 App 对象的 MVC ASP.NET azure 网站执行此操作?谢谢。
    • 这是already answered。打开 Global.asax 并在Application_Start() 中添加System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
    • 我的项目中没有 global.asax。这是一个 ASP.NET MVC 项目
    • 那么您使用的是 ASP.NET Core。 Global.asax 在 Core 中被 Startup.cs 取代。也许这会帮助stackoverflow.com/questions/40523565/…
    猜你喜欢
    • 2023-03-26
    • 2021-09-03
    • 1970-01-01
    • 1970-01-01
    • 2011-12-14
    • 1970-01-01
    相关资源
    最近更新 更多