2010-01-06 83 views
0

我正在构建一个ASP.NET 3.5应用程序,其中有一个页面可以在iframe中的另一个域中加载另一个页面。下面是为Default.aspx的页:无法在iframe中加载webstep

<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中:

    保护无效的Application_BeginRequest(对象发件人,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德维TAII PSA “PSD IVAi IVDi CONi HIS我们的IND”\“”);

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

回答

0

如果我已经知道你要完成什么,试试这个:

isite.aspx:

<script type="text/javascript"> 

    window.onload = function(){ 
     setTimeout(function{ 
      document.forms[0].submit(); 
     },2000); 
    } 
</script> 

无需后面的代码和图像按钮的一项PostBackUrl属性。

+0

那么我试过,我仍然得到相同的错误HTTP 500错误。 – Kumar 2010-01-06 06:31:35

+0

您是否验证过网址? – jerjer 2010-01-07 05:11:54