Solved

IFRAME redirect page to Root ASP.NET

Posted on 2007-04-02
4
1,929 Views
Last Modified: 2008-02-07
In my page I have an iframe.  When a certain thing happens in the code behind the iframe, the code below will execute

            HttpContext context = app.Context;

            context.Response.Clear();
            context.Server.Transfer("~/Page.aspx");

but this code executes from within the IFRAME.  I want the page that contains the IFRAME to change, not just within the IFRAME
0
Comment
Question by:cophi
  • 2
4 Comments
 
LVL 7

Expert Comment

by:mem99999
ID: 18839176
Hi cophi,

Try this code in the IFRAME:

string redirectCode = "<script>window.open('~/Page.aspx','_top');</script>";
Response.Write(redirectCode);

It works perfectly on my website to redirect the user from an iframe.
0
 

Author Comment

by:cophi
ID: 18839262
I don't want to pop up a new window though, I want it to redirect the parent page.  I was also hoping to do this from the server side.  Somehow manipulating the request or response object.
0
 
LVL 7

Expert Comment

by:mem99999
ID: 18839434
My code will not open a new window, notice the target '_top'

It will be redirecting the user from the same browser window.
0
 
LVL 18

Accepted Solution

by:
Ajay Sharma earned 500 total points
ID: 18842500
put this on the button click event

Response.Write("<script>" & vbCrLf)
                        Dim strs As String
                        strs = "window.open('admin.aspx "','_parent');"
                        Response.Write(strs & vbCrLf)
                        Response.Write("</script>")
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

822 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question