Reputation: 2483
Is it possible to perform a response.redirect within an iFrame to redirect the whole page so that the destination page is viewable full screen and not contained within the iFrame?
Below is the current code behind
public partial class ServerResult : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Any help would be much appreciated :-)
Upvotes: 1
Views: 3133
Reputation: 148524
No.
Response.Redirect
is a server command which sends (302 ?) header tells the client to redirect.
you are in the iframe world. you can't tell the server: "Hey , when you send me data - send it to the parent Iframe"
BUT What you can do , is this :
protected void Page_Load(object sender, EventArgs e) {
ClientScriptManager.RegisterClientScriptBlock(this.GetType(),
"aaa", "window.parent.location = 'http://yoursite.com'", true);
}
but you have to remove response.redirect from server.
Edit
var page = HttpContext.Current.Handler as Page;
if (page != null) page.ClientScript .RegisterClientScriptBlock(typeof(string), "Redirect", "window.parent.location='" + url + "';", true);
Upvotes: 1