The solution we came up with in the end was a little hacky but seems quite elegant.
Start by intercepting any 302's that come from an ajax query in your global.asax file.
protected void Application_EndRequest()
{
var context = new HttpContextWrapper(Context);
if (Context.Response.StatusCode == 302 && context.Request.IsAjaxRequest())
{
Context.Response.Clear();
Context.Response.StatusCode = 308;
}
}
We invented a status code of 308, so that the browser doesn't intercept the 302 and cause jquery to fail.
And then somewhere in your javascript global file, add the following
$(document).ajaxError(function (e, request, errorThrown, exception) {
if (request.status == "308") {
window.location = request.getResponseHeader('location');
}
});
This causes jquery to be able to detect the redirect, and then direct the user to the requested page.