Reply to comment
Ajax - Exception has been thrown by the target of an invocation
Submitted by admin on Sat, 02/28/2009 - 19:36
If you're working with Ajax in .NET, you'll probably see an exception like this at some point:
Exception has been thrown by the target of an invocation
Not very helpful. What you need to do is tell the ScriptManager to catch post back errors and re-throw the InnerException. Change your ScriptManager to look like this:
<asp:ScriptManager ID="ScriptManager1" runat="server" OnAsyncPostBackError="ScriptManager1_AsyncPostBackError">
</asp:ScriptManager>
Then add this to your code behind:
protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
{
if (e.Exception != null && e.Exception.InnerException != null)
{
ScriptManager1.AsyncPostBackErrorMessage = e.Exception.InnerException.Message;
}}
Now you should see the real exception message come through.


Recent comments
11 hours 22 min ago
16 hours 56 min ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
1 week 4 days ago
2 weeks 13 hours ago
2 weeks 13 hours ago
2 weeks 14 hours ago
2 weeks 16 hours ago