views:

54

answers:

1

I am building an ASP.NET 3.5 application in which I have a page which loads another page in a different domain in an iframe. Below is the for Default.aspx page:

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

    </iframe>
</asp:Content>

Below is the iframe page isite.aspx:

    <html xmlns="http://www.w3.org/1999/xhtml"&gt;
    <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>

Below is the isite.aspx.cs page:

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

This works fine in Firefox,Safari and Chrome but it dosent work in IE 7 or 8. In IE it gives me a HTTP 500 error page. After doing some research on it I figured that its a cookie issue in IE and tried the below soutions:

  1. Added the following code to the 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. Added the following line of code to the Page_Init and Page_Load events

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

None of these solutions worked for me. What am I missing?

A: 

If I have understand what you are trying to accomplish, try this:

isite.aspx:

<script type="text/javascript">

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

No need for the code behind and PostBackUrl attribute of the image button.

jerjer
Well I tried that and I still get the same error HTTP 500 error.
Kumar
Have you verified the url?
jerjer