Client-Side Callbacks and Exceptions

Those that already worked with Client-Side Callbacks know that when add the reference in control client events; we can to define an error client function that will be gone off if the server-side method throws an exception.

So, there is a problem in this scene: if the server-side method throws an exception and the mode attribute of customErrors section will be with On or RemoteOnly (this is default), your callback never work correctly and the following message will pass as argument for the error client function:

There was an error in the callback.

This error occurs when an exception is throwing, the page is changed and customErrors intercept the process, so the above message is returned for client instead Exception message.

If you define the customErrors as Off, the process will work, but depending of your error handling strategy, this configuration will be able to disclose important details about the error, because it displays for all clients. To resolve this, maybe it’s necessary isolate the page that use the callback in a different directory, add a new Web.Config file, override the customErrors section to Off and involve page’s code in Try.Catch.Finally statement.

Comments

No Comments