我使用ASP的AJAX框架,我试图做的JavaScript所谓的web服务的一些异常日志记录。
I am using ASP's AJAX framework and I am trying to do some exception logging on the javascript-called webservice.
看,我发现一些人的处理它们的客户端,并送他们回服务器。我想preFER没有这样做,因为它依赖于其他的服务器通话(如果它失败的第一次,发送一个请求,其他看起来并不像一个好主意,这让我改变我的所有来电)
Looking through the web, I find some people handling them client-side and sending them back to the server. I'd prefer not doing that since it relies on an other server call (if it failed the first time, sending an other request doesn't look like a good idea and that makes me change all my calls)
我看到一些其他人decorating他们所有的方法,提供的try ... catch块(这会导致重复的错误处理,但一个其他try catch块)。
I see some other people decorating all their methods with try... catch blocks (which leads to duplicate error handling, and yet an other try catch block).
不过,我想实现类似于Global.asax中的东西的Application_Error()它处理每一个未捕获的异常(不,它似乎并没有被要求AJAX调用的方法例外)。
However, I'm trying to achieve something similar to global.asax's Application_Error() which handles every uncaught exception (nope, it doesn't seem to be called for AJAX called methods exceptions).
是,即使可能吗?
推荐答案使用 ELMAH - 它可以捕捉阿贾克斯错误。
Use ELMAH - it can capture ajax errors.
更多推荐
服务器端ASP.Net Ajax的异常处理
发布评论