How to avoid “PageRequestManagerTimeOutException” while using Ajax Control Toolkit?
I was having a problem when developing an ASP.NET Web Application using Ajax Control Toolikit.
On one of my Report pages, the constructed SQL query using LINQKit was pretty complex. It took a while for the SQL Server to return the results.
The complexity depends on the amount of specified filter parameters by the user. There are also calculations and transformations performed on the SQL results, which of course affect the request execution time.
First thought was to increase the Ajax PostBack Timeout. I can be set in the code behind – by default it’s set to 90 seconds:
ScriptManager.AsyncPostBackTimeout = 120;
But what if there are more users requesting a report at the same time? At least I need to inform them, why they didn’t get what they were expecting.
So if I attach my code that displays an alert message and/or redirects to an error page, that would be great! I could better handle this timeout.
Some explanation of this code sample:
– get the current Script Manager instance
– attach custom endRequest event function
– check if the request ends with an error of the type:
– if the above^ condition is true, notice the Script Manager that this
– finally redirect to custom error page (display error message, send error
reqManager._postBackSettings.panelID provides me extra informs about the update panel that started the request, because there are more of them on one page.