When developing typical server side functionality in ASP.NET we don’t usually worry about the users experience with errors or authentication issues. We don’t worry about that much because we know our custom error pages and forms auth will redirect our clients to the appropriate content. Its not great that our client gets redirected to an error page, but its better than the YSOD, etc.
When we’re working with ajax requests, we don’t have any of this built in functionality. Everything is up to us and the callbacks that we setup. All of our clients will eventually encounter unhandled exceptions during their ajax requests and without the proper handling, the users experience could be awful. Nowadays, the more we can control the users experience, especially in the event of a failure, the better. This article is all about building a way to easily handle the common types of failures and ensuring predictable results for our clients. This stuff isn’t that hard, and we should be able to do it in a way that “just works” for all ajax requests that we make.