Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - how to redirect parent page from iframe page_load?

 
Thread Tools Search this Thread
Old 04-28-2005, 04:02 PM   #1
Default how to redirect parent page from iframe page_load?


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
  Reply With Quote
Old 04-28-2005, 07:24 PM   #2
Robbe Morris [C# MVP]
 
Posts: n/a
Default frame buster code
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]
  Reply With Quote
Old 04-28-2005, 09:41 PM   #3
Sheryl Landon
 
Posts: n/a
Default Re: frame buster code
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
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46