gpt4 book ai didi

c# - 仅在 safari 浏览器中,ASP.net MVC 中的 IFrame 中的 session 为空

转载 作者:太空狗 更新时间:2023-10-29 18:16:09 24 4
gpt4 key购买 nike

页面包含 IFrame 且 session 仅在 Safari 的情况下为空。我的 Safari 版本是 5.1.7

我正在使用 MVC 4.5 一切都在其他浏览器中完美运行。我正在使用下面的代码..

protected override void OnResultExecuting(ResultExecutingContext filterContext)
{
base.OnResultExecuting(filterContext);
filterContext.HttpContext.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\"");
GetFirstError();
}

最佳答案

我们有完全相同的问题 - FB 应用程序在 ASP.Net MVC 项目的 Safari 中无法运行。以下是我们为修复它所做的工作:

  1. 将 P3P header 添加到所有 reposons。您可以在 IIS 服务器级别配置它:http://support.microsoft.com/kb/324013 - 或者直接在 global.asax 中执行:

    protected void Application_BeginRequest(Object sender, EventArgs e)
    {
    HttpContext.Current.Response.AddHeader("P3P", "CP=\"NOI CURa ADMa DEVa TAIa OUR BUS IND UNI COM NAV INT\"");
    }
  2. 在您网站的根目录(所谓的知名位置)创建w3c 文件夹并上传p3p.xmlpolicy.p3p 按照 Microsoft 指南将文件放入其中:How to Deploy P3P Privacy Policies on Your Web Site

这是我的 p3p.xml 文件:

<META>
<POLICY-REFERENCES>
<POLICY-REF about="/w3c/policy.p3p">
<INCLUDE>/</INCLUDE>
<COOKIE-INCLUDE/>
</POLICY-REF>
</POLICY-REFERENCES>
</META>

和 policy.p3p(抱歉,它很长,但我不确定如何隐藏它作为剧透):

<?xml version="1.0"?>
<POLICIES xmlns="http://www.w3.org/2002/01/P3Pv1">
<!-- Generated by IBM P3P Policy Editor version Beta 1.12 built 2/27/04 1:19 PM -->

<!-- Expiry information for this policy -->
<EXPIRY max-age="86400"/>

<POLICY
xml:lang="uk">
<!-- Description of the entity making this policy statement. -->
<ENTITY>
<DATA-GROUP>
</DATA-GROUP>
</ENTITY>

<!-- Disclosure -->
<ACCESS><nonident/></ACCESS>

<!-- No dispute information -->

<!-- Statement for group "Basic information" -->
<STATEMENT>
<EXTENSION optional="yes">
<GROUP-INFO xmlns="http://www.software.ibm.com/P3P/editor/extension-1.0.html" name="Basic information"/>
</EXTENSION>

<!-- Consequence -->
<CONSEQUENCE>
Data collected from all Web users: access logs, and search strings (if entered).</CONSEQUENCE>

<!-- Use (purpose) -->
<PURPOSE><admin/><current/><develop/></PURPOSE>

<!-- Recipients -->
<RECIPIENT><ours/></RECIPIENT>

<!-- Retention -->
<RETENTION><indefinitely/></RETENTION>

<!-- Base dataschema elements. -->
<DATA-GROUP>
<DATA ref="#dynamic.clickstream"/>
<DATA ref="#dynamic.http"/>
<DATA ref="#dynamic.searchtext"/>
</DATA-GROUP>
</STATEMENT>

<!-- Statement for group "Cookies" -->
<STATEMENT>
<EXTENSION optional="yes">
<GROUP-INFO xmlns="http://www.software.ibm.com/P3P/editor/extension-1.0.html" name="Cookies"/>
</EXTENSION>

<!-- Consequence -->
<CONSEQUENCE>
Cookies are used to track visitors to our site,
so we can better understand what portions of our site best serve you.</CONSEQUENCE>

<!-- Use (purpose) -->
<PURPOSE><develop/><tailoring/></PURPOSE>

<!-- Recipients -->
<RECIPIENT><ours/></RECIPIENT>

<!-- Retention -->
<RETENTION><business-practices/></RETENTION>

<!-- Base dataschema elements. -->
<DATA-GROUP>
<DATA ref="#dynamic.cookies" optional="yes"><CATEGORIES><uniqueid/></CATEGORIES></DATA>
</DATA-GROUP>
</STATEMENT>

<!-- End of policy -->
</POLICY>
</POLICIES>

关于c# - 仅在 safari 浏览器中,ASP.net MVC 中的 IFrame 中的 session 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20146173/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com