Solved

IFRAME redirect page to Root ASP.NET

Posted on 2007-04-02
4
1,936 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

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.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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 count occurrences of each item in an array.

739 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