Response.Redirect() in iFrame, redirect parent window

I know this isn't possible, but what is the best alternative for wanting to do Response.Redirect from an iFrame, to redirect the parent page?

You can not do this using ASP.NET. ASP.NET on server side can redirect incoming request and can't know about a parent frame.

But if you want to redirect parent frame on some server side condition you can call JavaScript from server like this:

protected void Page_Load(object sender, EventArgs e) {
       "RedirectScript", "window.parent.location = ''", true);

And of course you can use simple JavaScript window.parent.location = '' on client side.

Redirect the parent page from IFrame, ClientScript.RegisterStartupScript(GetType(), "Load", "<script We can redirect from both server and client side when using Iframe<>. Client side response: Write("<script type=text/javascript> window.parent.location.href� The parent window, in itself, could be an IFrame, too.Since the accepted answer addresses the top window, I suggest you change your question a bit. – Ron Klein Oct 10 '12 at 19:33

I just used the following code with success. It even bypassed the X-Frame-Options SAMEORIGIN and allows redirection from one domain to another one in an iframe:

string url = "";

With string interpolation (since C# 6):

string url = "";

URL Redirect: Breaking Out of an iFrame, The second option would be to redirect the page where you have your iframe embedded, known as the "parent" page. Modern browsers will� CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100

Header.Controls.Add(new LiteralControl(@"
<script type=""text/javascript"">
top.location = ""/Logout.aspx"";
parent.location = ""/Logout.aspx"";

Global.asax : Response.Redirect from iframe to parent page, Yes you can handle as following. By having the following javascript/jQuery code within the custom error page head section, it will check� Response.Redirect to new (parent) page These Forums are dedicated to discussion of DNN Platform and Evoq Solutions . For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

    url = "Your.asp?YourVar="&YourVar
    %> \end your classic asp code and pass to the script below
    <script type='text/javascript'> = '<%= url %>'</scrip>

Redirect parent page from within Iframe, When you want to redirect the parent Window to another Location from your NET+2.0+C%23+response+preformance+tuning&asp. +list+selectedindex+ problem+databind()&drop+down+list+selectedindex+problem+� Response.Redirect will only effect the page in the iFrame if that is the page that is doing the redirect on the server side. You want to run some javascript within that iFrame that will redirect the parent, as you have in your second example.

Response.Redirect to new (parent) page - IFrame, aspx page inside of an IFrame module. In postback after some verification I want to redirect to other dnn page: Response.Redirect("/Registration/� For example, if a page in a CHILD IFRAME invokes a Response.Redirect("blah.aspx"), only the CHILD IFRAME content reloads to "blah.aspx". How to I Redirect (or Server.Transfer(), if that works) from a CHILD IFRAME in such a way that causes the top-level window to load the specified page?

Redirection from iframe in or javascript, Here we using the server side onClick event of asp:button to redirecting user to another page and client side OnClientClick event to open new� This is the line of code that I need to change: MM_redirectLoginSuccess="m embers.asp " It works just fine useing the log in user function in dreamweaver. However, it is opening the page in a whole new window.

Response.Redirect() in iFrame, redirect parent window, Response.Redirect() in iFrame, redirect parent window. Question. I know this isn't possible, but what is the best alternative for wanting to do Response.Redirect� The most concise screencasts for the working developer, updated daily. There's no shortage of content at Laracasts. In fact, you could watch nonstop for days upon days, and still not see everything!

  • Note that the domains of the frame and parent frame documents will need to match to avoid an access denied error being thrown by most browsers.
  • If my parent has another domain in the frame?