Asp.net Ajax offers variety of ways to handle error that occur when the page is posted back asynchronously. Every time an error occurs in an asynchronous page request, script manager will raise an onasyncpostbackerror event. If you need to customize the error that get sent to the user, you can register with the event and set the a friendly error message on AsyncPostBackErrorMessage property available on ScriptManager. Code below shows an example where I am setting a friendly error message on the AsyncPostBackErrorMessage instead of displaying the exact error thrown on the server side code.
ScriptManager also honors error setting defined in the web.config of how to handle errors. If you have defined customerror section and have the mode set to on than you will be redirected to the custom error page defined by defaultRedirect when an error occurs in an async page request. For some reason, if you decide that for errors that happen asynchronously, you do not want it handled by a custom error page, you can turn off the setting explicitly on the ScriptManager by setting AllowCustomRedirects to false. By default it is set to true so if an error occurs, ScriptManager would honor the setting defined inside of web.config file.