Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, December 9, 2008 1:04 PM
Hi,
I have some problems when using AJAX with updatepanels.
I have an ASP.NET webapplication with a login that uses form authentication with the timeout set to 5 min. After 5 min of idle the site should be redirected to the login.aspx page. My problem is that after using the site for 5 minutes when clicking on contents inside an updatepanel I get a messagebox with the following error:
A Runtime Error has occurred.
Do you wish to Debug?
Line: 4723
Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12031
I think that it has something to do with the ajax updatepanel since when I remove the updatpanels this problem does not appear. Instead the site is redirected to login.aspx as expected.
When searching on the problem on google I see alot of people having similar problem, but I haven't found suitable solution. Any suggestions?
All replies (3)
Wednesday, December 10, 2008 12:43 AM ✅Answered
you can refer the following link
http://forums.asp.net/t/1123365.aspx
and also
http://forums.asp.net/t/1130625.aspx
Thursday, December 11, 2008 2:35 AM ✅Answered
I found a solution:
Set timeout for form authent. and session to same value in this case 35 minutes:
<system.web>
<!--Handles form authent time out-->
<authentication mode="Forms">
<forms name=".admlog" loginUrl="~/Login.aspx" path="/" protection="All" timeout="35" slidingExpiration="true">
<credentials passwordFormat="Clear">
<user name="admin" password="admin"/>
</credentials>
</forms>
</authentication>
<!--Handles session time out-->
<sessionState timeout="35" mode="InProc" cookieless="false"/>
</system.web>
Then use the following example to implement a graceful redirect of the user:
http://www.codeproject.com/KB/session/redirecttimeout.aspx
I made some modification to the CheckSessionTimeout() method letting the user be able to refresh the session timeout (see bolded code):
private void CheckSessionTimeout()
{
string msgSession = **"Warning: The site has been inactive for more then 30 minutes. You will be automatically redirected to login site after 5 minutes unless you refresh the session. Do you want to refresh session?
** //time to remind, 5 minutes before session end
int int_MilliSecondsTimeReminder = (this.Session.Timeout * 60000) - 5 * 60000;
//time to redirect, 5 miliseconds before session end
int int_MilliSecondsTimeOut = (this.Session.Timeout * 60000) - 5;
string str_Script = @"
var myTimeReminder, myTimeOut;
clearTimeout(myTimeReminder);
clearTimeout(myTimeOut); " +
"var sessionTimeReminder = " + int_MilliSecondsTimeReminder.ToString() + "; " +
"var sessionTimeout = " + int_MilliSecondsTimeOut.ToString() + ";" +
"function doReminder() "+
"{ "+
"if(confirm('" + msgSession + "')) window.location.href=window.location.href; "+
"}" **+
** "function doRedirect(){ window.location.href='Default.aspx'; }" + @"
myTimeReminder=setTimeout('doReminder()', sessionTimeReminder);
myTimeOut=setTimeout('doRedirect()', sessionTimeout); ";
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "CheckSessionOut", str_Script, true);
}
Wednesday, September 8, 2010 8:37 AM
http://sysisundefined.blogspot.com/2010/09/unknown-error-occurred-while-processing.html