We have a web page designed to be embedded in an iFrame on a host web site.
The session timeout for the web site that serves up the iFrame page is 20 minutes.
In our testing, the iFrame page times out as expected in various browsers like IE, Chrome, Safari and with IE8/XP and IE9/Win7.
A customer with a classic asp site has embedded our web page in an iFrame on their site. OUr iFrame web page refuses to time out for them except for certain browsers. THey feel they have narrowed it down to IE in Win7 and Vista. It works otherwise.
Any idea why this might be happening? The customer indicates they aren't doing anything to refresh the page and it seems to only happen with IE. They spent a considerable amount of time helping me narrow it down.
Any help on this question would be greatly appreciated.
related to this, what would happen to the session if the app pool Idle Timeout kicks in before the session timeout occurs for a page? Does the session variable get set to null or does a new session get created on the next postback of the page? I'm thinking
the latter.
I just set the app pool idle time to 5 minutes while session timeout was 20. The web site was truly idle for 25 mins. The session timeout still worked as normal. So I have ruled app pool Idle Time out as the culprit. Still stumped.
This is the code we use to detect a timeout on a postback. We intercept the timeout in an overridden OnLoad event in a BasePage class. The base class inherits System.Web.UI.Page.
overrideprotectedvoid
OnLoad(EventArgs
e){
base.OnLoad(e);
try
{
if (Page.IsPostBack) //only check for timeout on postback, not on page load.
{
if (Context.Session != null)
{
// IsNewSession is more advanced then simply checking if
// a cookie is present, it does take into account a session timeout.
if (Session.IsNewSession)
{
// If it says it is a new session, but an existing cookie is found, then it must
// have timed out (can't use the cookie collection because even on first
// request it already contains the cookie.
string cookieHeader = Request.Headers["Cookie"];
if ((cookieHeader != null) && (cookieHeader.IndexOf("MyCookieName") >= 0))
{
//Response.Redirect goes here....
}
}
}
}
}
catch
{
....
}
dmurphy7299
Member
22 Points
24 Posts
asp.net session not always timing out for page within an iFrame.
Jul 27, 2012 08:34 PM|LINK
We have a web page designed to be embedded in an iFrame on a host web site.
The session timeout for the web site that serves up the iFrame page is 20 minutes.
In our testing, the iFrame page times out as expected in various browsers like IE, Chrome, Safari and with IE8/XP and IE9/Win7.
A customer with a classic asp site has embedded our web page in an iFrame on their site. OUr iFrame web page refuses to time out for them except for certain browsers. THey feel they have narrowed it down to IE in Win7 and Vista. It works otherwise.
Any idea why this might be happening? The customer indicates they aren't doing anything to refresh the page and it seems to only happen with IE. They spent a considerable amount of time helping me narrow it down.
Any help on this question would be greatly appreciated.
Thanks, Dan
pro.shailend...
Participant
1000 Points
189 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 28, 2012 07:01 AM|LINK
I am also facing this type of problem in my web application.
Blog: Dot Net Tricks Windows Apps
Please "Mark As Answer" if my suggestions helps you
Damn Code
Participant
1883 Points
323 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 30, 2012 01:52 AM|LINK
Him friend
we have more ways to adjust session time out such as
visit these links to know more about that
Please remember to Mark the replies as Answers if they help & unmark them if they provide no help.
dmurphy7299
Member
22 Points
24 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 30, 2012 03:00 PM|LINK
thanks for the informational links. However that doesn't explain why it doesn't timeout in an iFrame in certain browsers and works normally otherwise.
dmurphy7299
Member
22 Points
24 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 30, 2012 04:11 PM|LINK
related to this, what would happen to the session if the app pool Idle Timeout kicks in before the session timeout occurs for a page? Does the session variable get set to null or does a new session get created on the next postback of the page? I'm thinking the latter.
dmurphy7299
Member
22 Points
24 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 30, 2012 05:27 PM|LINK
I just set the app pool idle time to 5 minutes while session timeout was 20. The web site was truly idle for 25 mins. The session timeout still worked as normal. So I have ruled app pool Idle Time out as the culprit. Still stumped.
FightAsABull
Contributor
2228 Points
424 Posts
Re: asp.net session not always timing out for page within an iFrame.
Jul 31, 2012 11:10 PM|LINK
iframe doesn't affect page Session, it just like use visit the page directly, how did you determine the Session isn't timeout?
http://stackoverflow.com/questions/1270910/iframe-keep-alive-function-what-is-needed-to-reset-the-session-timeout
dmurphy7299
Member
22 Points
24 Posts
Re: asp.net session not always timing out for page within an iFrame.
Aug 01, 2012 08:37 PM|LINK
the user presses a button on the page in the iFrame that does a postback. Upon postback, it does not timeout.
dmurphy7299
Member
22 Points
24 Posts
Re: asp.net session not always timing out for page within an iFrame.
Aug 08, 2012 06:52 PM|LINK
This is the code we use to detect a timeout on a postback. We intercept the timeout in an overridden OnLoad event in a BasePage class. The base class inherits System.Web.UI.Page.
override protected void OnLoad(EventArgs e){
base.OnLoad(e);
try
{
if (Page.IsPostBack) //only check for timeout on postback, not on page load.
{
if (Context.Session != null)
{
// IsNewSession is more advanced then simply checking if
// a cookie is present, it does take into account a session timeout.
if (Session.IsNewSession)
{
// If it says it is a new session, but an existing cookie is found, then it must
// have timed out (can't use the cookie collection because even on first
// request it already contains the cookie.
string cookieHeader = Request.Headers["Cookie"];
if ((cookieHeader != null) && (cookieHeader.IndexOf("MyCookieName") >= 0))
{
//Response.Redirect goes here....
}
}
}
}
}
catch
{
....
}
PatrickRR
Member
114 Points
53 Posts
Re: asp.net session not always timing out for page within an iFrame.
Aug 17, 2012 08:02 PM|LINK
Stop timeouts forever.
http://snippets.surfthru.com/post/Stop-ASPNET-Session-Timeouts.aspx