views:

352

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?

+1  A: 

Adding P3P headers is a best practice if you want a subframe to be able to use cookies, but you should look at the server logs to figure out why a HTTP/500 is getting generated in the first place, since it's the server/framework that's raising the error.

You also might want to turn off friendly errors in IE (see Tools / Internet Options / Advanced)

EricLaw -MSFT-
The reason behind the 500 error is that IE is trying to locate the session cookie which it is not able to find. The same code works in non-IE browsers,I checked the Response Header using the firebug tool and below is the responseCache-Control privateContent-Type text/html; charset=utf-8Server Microsoft-IIS/7.5p3p CP="CAO PSA OUR", CP="NOI DSP COR NID ADM DEV PSA OUR IND UNI PUR COM NAV INT STA"X-AspNet-Version 2.0.50727X-Powered-By ASP.NETDate Thu, 07 Jan 2010 07:18:46 GMTContent-Length 8601As you can see that the P3P information is there in the header,but it still dosent work in IE
Kumar
I would greatly appreciate any help or suggestions
Kumar
No, that's not correct. HTTP/500 is a SERVER error, not a client error. IE doesn't throw an error when it lacks a cookie.Watch your traffic in Fiddler2 and see what the response headers from the server are; post them here. Also, see what the text of the HTTP/500 message is.
EricLaw -MSFT-