Solved

IFRAME redirect page to Root ASP.NET

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
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…

760 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