2010-01-06 88 views
4

我正在构建一个ASP.NET 3.5应用程序,其中我有一个页面,该页面在iframe中的另一个域中加载另一个页面。下面是为Default.aspx的页:Internet Explorer Iframe Cookie问题

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" runat="server"> 
    <iframe src="isite.aspx" runat="server" width="100%" height="100%" scrolling="auto"> 

    </iframe> 
</asp:Content> 

下面是在iframe页面isite.aspx

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head id="Head1" runat="server"> 
     <title>Untitled Page</title> 
    </head> 
    <body style="margin: 0; text-align: center;"> 
     <form id="Form1" name="frmSubmit" action="https://mysite.com/Login.asp" 
     method="POST" runat="server"> 
     <span style="font-family: Arial"> 
      <asp:ImageButton ID="ImageButton1" runat="server" PostBackUrl="https://mysite.com/Login.asp" ImageUrl="/ajax-loader.gif" /> Please wait... 
    <br /> 
     </span> 
     <input type="hidden" name="txtUserName" size="30" maxlength="50" value="admin" 
      onkeypress="Javascript:CheckKeyPress('ID')"/> 
     <input type="hidden" name="pwdPassword" size="30" maxlength="25" value="password" 
      onkeypress="Javascript:CheckKeyPress('P')"/> 
     </form> 
    </body> 
    </html> 

下面是isite.aspx.cs页:

protected void Page_Load(object sender, EventArgs e) 
    { 
     Page.ClientScript.RegisterStartupScript(Page.GetType(), "click", "<script language=javascript>document.getElementById('" + ImageButton1.ClientID + "').click();</script>"); 
    } 

这在Firefox,Safari和Chrome中运行良好,但它在IE 7中可以工作或者8.在IE中,它给了我一个HTTP 500错误页面。它做一些研究之后,我想通它在IE浏览器cookie中的问题,并试图以下soutions:

  1. 下面的代码添加到Global.asax中:

    protected void Application_BeginRequest(object sender, EventArgs e)
    {
    HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");
    }

  2. 添加了下面的代码行到Page_Init和的Page_Load事件

    HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"");

这些解决方案都不适用于我。我错过了什么?

+0

我有同样的问题,希望找到一个解决方案帽,我刚刚发现这个旧文章http://connect.microsoft.com/IE/feedback/详细信息/ 369240/ie8-will-not-send-third-party-cookies-set-in-another-window-tab其中说IE8和IE团队中的bug会解决,什么时候?我不知道:( – 2010-03-01 18:27:37

+0

您是否找到了解决方案? – Bob 2012-08-13 10:46:53

回答

0

我在IE中遇到了同样的问题,没有一个在线解决方案帮助我,在我的情况下,我强迫用户在iframe内再次登录,这对我很有用。

1

“P3P”应该是像“P3P”