页面包含IFrame,并且仅在Safari中, session 为null。我的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中不起作用。这是我们为修复它所做的事情:

  • 将P3P header 添加到所有 repo 中。您可以在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\"");
    }
    
  • 根据此Microsoft指南在网站的根目录(所谓的知名位置)中创建w3c文件夹,并将p3p.xmlpolicy.p3p文件上载到该文件夹​​:

    这是我的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>
    

  • 09-27 16:32