468,161 Members | 1,952 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,161 developers. It's quick & easy.

IFRAME session timeout trap error question

In javascript code on MyPage.aspx, I set a hidden IFRAME's source url:

myframe.location.href = 'someotherpage.aspx';

If the session has timed out, preventing someotherpage.aspx from being
loaded into the IFRAME, where can that error condition be trapped?
Thanks
Timo
Nov 19 '05 #1
3 9094
Making any kind of request through the frame would re-establish a timed out
session.......I'll assume here there are values that have been set that make
the session invalid, whihc is whay your looking for some form of solution.
So, then it depends on how you handle the page server side, and how you
process the results. You can trap it server side using a generic error
handler in your asp.net code, as described here:

http://www.15seconds.com/issue/030102.htm

and then evaluate what returned with javascript if you need to, and for some
reason cant display an actual message in the frame.

http://www.faqts.com/knowledge_base/...d/9967/fid/129

or you could use remote scripting to check if the session is still active
before you make any requests

http://www.oreillynet.com/pub/a/java...08/iframe.html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Timo" <Ti**@somewherelese.com> wrote in message
news:eW**************@TK2MSFTNGP15.phx.gbl...
In javascript code on MyPage.aspx, I set a hidden IFRAME's source url:

myframe.location.href = 'someotherpage.aspx';

If the session has timed out, preventing someotherpage.aspx from being
loaded into the IFRAME, where can that error condition be trapped?
Thanks
Timo

Nov 19 '05 #2
John,
I've narrowed down the problem: Response.Redirect(...) does not seem to do
anything when invoked in the Page_Load eventhandler of an aspx page which
has been loaded into an IFRAME.

1. Mypage.aspx contains a hidden IFRAME which is used as an alternative to
XMLHttp to fetch data from a database without a postback
2. Javascript on mypage.aspx sets the IFRAME's url. For example:
myframe.location.href = 'fetchdata.aspx';
This works OK.
3. fetchdata.aspx in its Page_Load() looks to see if there's a valid session
(the session may have timed out); if the session has expired, we try to
redirect to Logon.aspx:
Response.Redirect("Logon.aspx")

But this does not work. I've stepped through the code, and although the
Response.Redirect("Logon.aspx") line does get executed, it has no effect. So
the problem is, mypage.aspx, expecting to get data back from fetchdata.aspx,
instead gets nothing and just sits there. So I need a way for
fetchdata.aspx (in the IFRAME) to tell its parent document (mypage.aspx)
that the session has timed out. I suppose fetchdata.aspx could write some
dynamic javascript that invokes a function in mypage.asxp, but I was hoping
for something more elegant.

Is this IFRAME Page_Load Response.Redirect do-nothingness by design?
Timo

"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
Making any kind of request through the frame would re-establish a timed out session.......I'll assume here there are values that have been set that make the session invalid, whihc is whay your looking for some form of solution.
So, then it depends on how you handle the page server side, and how you
process the results. You can trap it server side using a generic error
handler in your asp.net code, as described here:

http://www.15seconds.com/issue/030102.htm

and then evaluate what returned with javascript if you need to, and for some reason cant display an actual message in the frame.

http://www.faqts.com/knowledge_base/...d/9967/fid/129

or you could use remote scripting to check if the session is still active
before you make any requests

http://www.oreillynet.com/pub/a/java...08/iframe.html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Timo" <Ti**@somewherelese.com> wrote in message
news:eW**************@TK2MSFTNGP15.phx.gbl...
In javascript code on MyPage.aspx, I set a hidden IFRAME's source url:

myframe.location.href = 'someotherpage.aspx';

If the session has timed out, preventing someotherpage.aspx from being
loaded into the IFRAME, where can that error condition be trapped?
Thanks
Timo


Nov 19 '05 #3
the iframe redirect works fine. if you looked in the iframe you'd see the
login page. server redirects do not support specifing the window (target).
you need to fall back to client script.

-- bruce (sqlwork.com)
"Timo" <ti**@somewhereelse.com> wrote in message
news:uo*************@tk2msftngp13.phx.gbl...
| John,
| I've narrowed down the problem: Response.Redirect(...) does not seem to do
| anything when invoked in the Page_Load eventhandler of an aspx page which
| has been loaded into an IFRAME.
|
| 1. Mypage.aspx contains a hidden IFRAME which is used as an alternative
to
| XMLHttp to fetch data from a database without a postback
| 2. Javascript on mypage.aspx sets the IFRAME's url. For example:
| myframe.location.href = 'fetchdata.aspx';
| This works OK.
| 3. fetchdata.aspx in its Page_Load() looks to see if there's a valid
session
| (the session may have timed out); if the session has expired, we try to
| redirect to Logon.aspx:
| Response.Redirect("Logon.aspx")
|
| But this does not work. I've stepped through the code, and although the
| Response.Redirect("Logon.aspx") line does get executed, it has no effect.
So
| the problem is, mypage.aspx, expecting to get data back from
fetchdata.aspx,
| instead gets nothing and just sits there. So I need a way for
| fetchdata.aspx (in the IFRAME) to tell its parent document (mypage.aspx)
| that the session has timed out. I suppose fetchdata.aspx could write some
| dynamic javascript that invokes a function in mypage.asxp, but I was
hoping
| for something more elegant.
|
| Is this IFRAME Page_Load Response.Redirect do-nothingness by design?
| Timo
|
| "John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
| news:On**************@TK2MSFTNGP09.phx.gbl...
| > Making any kind of request through the frame would re-establish a timed
| out
| > session.......I'll assume here there are values that have been set that
| make
| > the session invalid, whihc is whay your looking for some form of
solution.
| > So, then it depends on how you handle the page server side, and how you
| > process the results. You can trap it server side using a generic error
| > handler in your asp.net code, as described here:
| >
| > http://www.15seconds.com/issue/030102.htm
| >
| > and then evaluate what returned with javascript if you need to, and for
| some
| > reason cant display an actual message in the frame.
| >
| > http://www.faqts.com/knowledge_base/...d/9967/fid/129
| >
| > or you could use remote scripting to check if the session is still
active
| > before you make any requests
| >
| > http://www.oreillynet.com/pub/a/java...08/iframe.html
| >
| > --
| > Regards
| >
| > John Timney
| > ASP.NET MVP
| > Microsoft Regional Director
| >
| > "Timo" <Ti**@somewherelese.com> wrote in message
| > news:eW**************@TK2MSFTNGP15.phx.gbl...
| > > In javascript code on MyPage.aspx, I set a hidden IFRAME's source url:
| > >
| > > myframe.location.href = 'someotherpage.aspx';
| > >
| > > If the session has timed out, preventing someotherpage.aspx from being
| > > loaded into the IFRAME, where can that error condition be trapped?
| > > Thanks
| > > Timo
| > >
| > >
| >
| >
|
|
Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Darrin J Olson | last post: by
3 posts views Thread by charliewest | last post: by
13 posts views Thread by =?Utf-8?B?ZG91Zw==?= | last post: by
3 posts views Thread by trullock | last post: by
3 posts views Thread by dmalhotr | last post: by
1 post views Thread by gcdp | last post: by
reply views Thread by gcreed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.