I have a function that catches errors And when an error occurs I check if it is an AJAX error And if this AJAX changes the status of the error to 401 Unauthorized I changed both the Result and the status Code like this:
filterContext.HttpContext.Response.StatusCode = (int)HttpStatusCode.Unauthorized;
filterContext.Result = new HttpStatusCodeResult(System.Net.HttpStatusCode.Unauthorized);
filterContext.HttpContext.Response.SuppressFormsAuthenticationRedirect = true;
When I debug in c# I really see them 401 as what I changed and then it goes back to JS and there is 500 inside does anyone know why?
Thank you