Solved

IFRAME redirect page to Root ASP.NET

Posted on 2007-04-02
4
1,925 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bad <form> statement? 9 27
Best practice for a landing page 3 48
Scientific articles behind a login? 6 14
how to build a intranet site 8 18
This article discusses how to create an extensible mechanism for linked drop downs.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now