Ajax Extension framework的TimeoutException

The server request timed out" from the Ajax Extensionframework. Its occurred because the export operation was relatively long (something like 2 minutes) and the Ajax Extension Callback framework had a timeout.

To solve this problem we can increase the timeout. You can change the timeout time by adding a new property to the script manager control. This property is called AsyncPostBackTimeOut and it can help us to define the number of seconds before the request will throw a request timeout exception*.

For example if you want that the timeout will take maximum 10 minutes your code should be look like this:

 

<asp:ScriptManager ID="ScriptManager1" runat="server"

AsyncPostBackTimeOut="600" >

</asp:ScriptManager>  

 

The default value of the AsyncPostBackTimeOut property is 90 seconds.

 

If you want to handle this error in client side, you should register to end request event. In your handler check if an error occurred, and handle it (show an alert or put the error in a label).

I hope that this code sample will help you.

<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(requestEndHandler );

// This function will handle the end request event
function requestEndHandler(sender, args) {
   if( args.get_error() ){
      document.getElementByIdx_x("errorMessageLabel").innerText = 
         args.get_error().description;
      args.set_errorHandled(true);
   }
}

</script>
...

<div id="errorMessageLabel"></div>

--------------

Or if you need to change one time in a particular page the timeout, you can add this line inside the page:

AjaxControlToolkit.ToolkitScriptManager ajax = (AjaxControlToolkit.ToolkitScriptManager)this.Page.Master.FindControl("ToolkitScriptManager1");

if(ajax != null)

  ajax.AsyncPostBackTimeout = 600;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值