If you're like me, you sometimes use AJAX controls in your web page. And, if you're like me, you find that when they fail to behave as expected, you as the user are not notified as to the reason. Instead, the page will just stare back at you blankly: no spinning globe, no twirling fox to indicate that it is processing your request. Of course, what's really happened is that your AJAX request caused an unhandled exception on the server and the request was canceled. If you're like me (and if you've read this far I am forced to conclude we must be twins) you'd like some visibility into that unhandled exception.
There is a quick and easy solution! Simply add the following to your ASPX code-behind and during your debugging session Visual Studio will report the exception being thrown, complete with the exception message and stack trace. If you'd like to report the exception to the user, you would wrap the inner call in a try/catch block and update your UI (or Logging) accordingly.
Good luck!
C#
protected override void RaisePostBackEvent(IPostBackEventHandler source, String eventArgument)
{
base.RaisePostBackEvent(source, eventArgument);
}
VB.NET
Protected Overrides Sub RaisePostBackEvent(ByVal source As IPostBackEventHandler, ByVal eventArgument As String)
MyBase.RaisePostBackEvent(source, eventArgument)
End Sub