IFRAME session timeout trap error question

T

Timo

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
 
J

John Timney \(ASP.NET MVP\)

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/view.phtml/aid/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/javascript/2002/02/08/iframe.html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
T

Timo

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
 
B

bruce barker

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)


| 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
|
| | > 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/view.phtml/aid/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/javascript/2002/02/08/iframe.html
| >
| > --
| > Regards
| >
| > John Timney
| > ASP.NET MVP
| > Microsoft Regional Director
| >
| > | > > 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
| > >
| > >
| >
| >
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top