![]() |
|
|
|||||||
![]() |
ASP Net - how to redirect parent page from iframe page_load? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hi, I'm having a similar issue as the poster Mike whose message I copied
below... I have a page with an iframe... when I discover that the session state is no longer valid in the page inside the iframe, I want to redirect the parent page to a login page. Can anyone help me? Thanks, Sheryl "MLibby" <> wrote in message news:<075419D9-7659-44BE-A58E->... > How can an IFrame's aspx page force a server-side redirect on its parent > page? Typically, an IFrame's client-side javascript specifies '_top' to > change the parent page... > window.open('default.aspx?SMID=18', '_top', '', false); > > However, the server-side Redirect doesn't include '_top'. I tried to > > write the following from server-side code hoping it would execute > > immediatly at the client but it won't fire, I'm not sure why: > > Response.Write("<script > > language=javascript>window.open('default.aspx?SMID =18', '_top', '', > > false);</script>"); > Please let me know if you have any ideas and thanks in advance for any > help, > Mike Sheryl Landon |
|
|
|
|
#2 |
|
Posts: n/a
|
Stick this at the top of all your non-iframe pages and
call it in the body onload event. If your page in an iframe attempts to redirect to one of the non-frame pages, it will break out of the iframe. function TimeOutRedirect() { try { if (self.parent.frames.length != 0) self.parent.location=document.location; } catch (Exception) {} } -- 2005 Microsoft MVP C# Robbe Morris http://www.robbemorris.com http://www.masterado.net/home/listings.aspx "Sheryl Landon" <> wrote in message news:... > Hi, I'm having a similar issue as the poster Mike whose message I copied > below... I have a page with an iframe... when I discover that the session > state is no longer valid in the page inside the iframe, I want to redirect > the parent page to a login page. Can anyone help me? > > Thanks, > Sheryl > > > "MLibby" <> wrote in message > news:<075419D9-7659-44BE-A58E->... > >> How can an IFrame's aspx page force a server-side redirect on its parent >> page? Typically, an IFrame's client-side javascript specifies '_top' to >> change the parent page... > >> window.open('default.aspx?SMID=18', '_top', '', false); > >> > However, the server-side Redirect doesn't include '_top'. I tried to >> > write the following from server-side code hoping it would execute >> > immediatly at the client but it won't fire, I'm not sure why: >> > Response.Write("<script >> > language=javascript>window.open('default.aspx?SMID =18', '_top', '', >> > false);</script>"); > >> Please let me know if you have any ideas and thanks in advance for any >> help, > >> Mike > > Robbe Morris [C# MVP] |
|
|
|
#3 |
|
Posts: n/a
|
Hey, that's way cool! the first thing I've seen that worked in my
situation! And I've tried quite a few "solutions" out there! Thanks! "Robbe Morris [C# MVP]" <> wrote in message news:%... > Stick this at the top of all your non-iframe pages and > call it in the body onload event. > > If your page in an iframe attempts to redirect to one of > the non-frame pages, it will break out of the iframe. > > function TimeOutRedirect() > { > > try > { > if (self.parent.frames.length != 0) > self.parent.location=document.location; > } > catch (Exception) {} > > } > > -- > 2005 Microsoft MVP C# > Robbe Morris > http://www.robbemorris.com > http://www.masterado.net/home/listings.aspx > > > > "Sheryl Landon" <> wrote in message > news:... >> Hi, I'm having a similar issue as the poster Mike whose message I copied >> below... I have a page with an iframe... when I discover that the session >> state is no longer valid in the page inside the iframe, I want to >> redirect the parent page to a login page. Can anyone help me? >> >> Thanks, >> Sheryl >> >> >> "MLibby" <> wrote in message >> news:<075419D9-7659-44BE-A58E->... >> >>> How can an IFrame's aspx page force a server-side redirect on its parent >>> page? Typically, an IFrame's client-side javascript specifies '_top' to >>> change the parent page... >> >>> window.open('default.aspx?SMID=18', '_top', '', false); >> >>> > However, the server-side Redirect doesn't include '_top'. I tried to >>> > write the following from server-side code hoping it would execute >>> > immediatly at the client but it won't fire, I'm not sure why: >>> > Response.Write("<script >>> > language=javascript>window.open('default.aspx?SMID =18', '_top', '', >>> > false);</script>"); >> >>> Please let me know if you have any ideas and thanks in advance for any >>> help, >> >>> Mike >> >> > > Sheryl Landon |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to access iframe from an aspx page | eyal1234 | Software | 1 | 07-22-2008 10:57 AM |
| .aspx page apears minimized when pops up | sam.dev | Software | 3 | 02-04-2008 03:04 PM |
| How to load Two iframe in one aspx page? | pratima | Software | 2 | 02-02-2008 03:17 AM |
| master page & app_theme folder doesn't work | dummies2 | General Help Related Topics | 0 | 09-04-2007 05:41 PM |
| Clear the Session value on page unload | tessythampan | Software | 1 | 08-12-2006 12:18 PM |